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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (383) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/README.md +2 -2
  3. package/build/components/block-editing-mode/index.cjs +13 -7
  4. package/build/components/block-editing-mode/index.cjs.map +2 -2
  5. package/build/components/block-inspector/index.cjs +50 -51
  6. package/build/components/block-inspector/index.cjs.map +2 -2
  7. package/build/components/block-rename/modal.cjs +0 -1
  8. package/build/components/block-rename/modal.cjs.map +2 -2
  9. package/build/components/block-toolbar/block-toolbar-icon.cjs +14 -6
  10. package/build/components/block-toolbar/block-toolbar-icon.cjs.map +2 -2
  11. package/build/components/colors-gradients/control.cjs +25 -14
  12. package/build/components/colors-gradients/control.cjs.map +2 -2
  13. package/build/components/colors-gradients/dropdown.cjs +4 -1
  14. package/build/components/colors-gradients/dropdown.cjs.map +3 -3
  15. package/build/components/contrast-checker/index.cjs +22 -4
  16. package/build/components/contrast-checker/index.cjs.map +2 -2
  17. package/build/components/date-format-picker/index.cjs +0 -1
  18. package/build/components/date-format-picker/index.cjs.map +2 -2
  19. package/build/components/global-styles/background-panel.cjs +153 -25
  20. package/build/components/global-styles/background-panel.cjs.map +3 -3
  21. package/build/components/global-styles/color-gradient-dropdown-item.cjs +227 -0
  22. package/build/components/global-styles/color-gradient-dropdown-item.cjs.map +7 -0
  23. package/build/components/global-styles/color-panel.cjs +98 -375
  24. package/build/components/global-styles/color-panel.cjs.map +3 -3
  25. package/build/components/global-styles/dimensions-panel.cjs +0 -3
  26. package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
  27. package/build/components/global-styles/hooks.cjs +34 -0
  28. package/build/components/global-styles/hooks.cjs.map +2 -2
  29. package/build/components/global-styles/typography-panel.cjs +82 -10
  30. package/build/components/global-styles/typography-panel.cjs.map +3 -3
  31. package/build/components/inspector-controls/groups.cjs +2 -0
  32. package/build/components/inspector-controls/groups.cjs.map +2 -2
  33. package/build/components/inspector-controls-tabs/styles-tab.cjs +75 -31
  34. package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
  35. package/build/components/link-control/index.cjs +1 -2
  36. package/build/components/link-control/index.cjs.map +2 -2
  37. package/build/components/list-view/block-select-button.cjs +1 -10
  38. package/build/components/list-view/block-select-button.cjs.map +3 -3
  39. package/build/components/provider/use-block-sync.cjs +3 -1
  40. package/build/components/provider/use-block-sync.cjs.map +2 -2
  41. package/build/components/url-popover/image-url-input-ui.cjs +0 -2
  42. package/build/components/url-popover/image-url-input-ui.cjs.map +2 -2
  43. package/build/components/use-block-display-information/index.cjs +10 -3
  44. package/build/components/use-block-display-information/index.cjs.map +2 -2
  45. package/build/components/use-resize-canvas/index.cjs +16 -53
  46. package/build/components/use-resize-canvas/index.cjs.map +3 -3
  47. package/build/hooks/anchor.cjs +0 -1
  48. package/build/hooks/anchor.cjs.map +2 -2
  49. package/build/hooks/background.cjs +124 -75
  50. package/build/hooks/background.cjs.map +3 -3
  51. package/build/hooks/color.cjs +0 -162
  52. package/build/hooks/color.cjs.map +3 -3
  53. package/build/hooks/contrast-checker.cjs +31 -28
  54. package/build/hooks/contrast-checker.cjs.map +3 -3
  55. package/build/hooks/custom-class-name.cjs +0 -1
  56. package/build/hooks/custom-class-name.cjs.map +2 -2
  57. package/build/hooks/elements.cjs +142 -0
  58. package/build/hooks/elements.cjs.map +7 -0
  59. package/build/hooks/grid-visualizer.cjs +21 -11
  60. package/build/hooks/grid-visualizer.cjs.map +2 -2
  61. package/build/hooks/layout-child.cjs +38 -8
  62. package/build/hooks/layout-child.cjs.map +2 -2
  63. package/build/hooks/layout.cjs +6 -3
  64. package/build/hooks/layout.cjs.map +2 -2
  65. package/build/hooks/states.cjs +15 -23
  66. package/build/hooks/states.cjs.map +2 -2
  67. package/build/hooks/style.cjs +8 -4
  68. package/build/hooks/style.cjs.map +2 -2
  69. package/build/hooks/typography.cjs +62 -10
  70. package/build/hooks/typography.cjs.map +3 -3
  71. package/build/layouts/flex.cjs +99 -6
  72. package/build/layouts/flex.cjs.map +2 -2
  73. package/build/private-apis.cjs +0 -1
  74. package/build/private-apis.cjs.map +2 -2
  75. package/build/store/private-actions.cjs +16 -0
  76. package/build/store/private-actions.cjs.map +2 -2
  77. package/build/store/private-keys.cjs +0 -3
  78. package/build/store/private-keys.cjs.map +2 -2
  79. package/build/store/private-selectors.cjs +24 -6
  80. package/build/store/private-selectors.cjs.map +2 -2
  81. package/build/store/reducer.cjs +19 -3
  82. package/build/store/reducer.cjs.map +2 -2
  83. package/build/utils/block-bindings.cjs +9 -9
  84. package/build/utils/block-bindings.cjs.map +3 -3
  85. package/build/utils/color-values.cjs +10 -1
  86. package/build/utils/color-values.cjs.map +3 -3
  87. package/build/utils/dom.cjs +2 -5
  88. package/build/utils/dom.cjs.map +3 -3
  89. package/build/utils/fit-text-frontend.cjs +6 -2
  90. package/build/utils/fit-text-frontend.cjs.map +3 -3
  91. package/build/utils/fit-text-utils.cjs +1 -1
  92. package/build/utils/fit-text-utils.cjs.map +3 -3
  93. package/build/utils/format-font-style.cjs +1 -1
  94. package/build/utils/format-font-style.cjs.map +3 -3
  95. package/build/utils/format-font-weight.cjs +1 -1
  96. package/build/utils/format-font-weight.cjs.map +3 -3
  97. package/build/utils/get-editor-region.cjs +4 -2
  98. package/build/utils/get-editor-region.cjs.map +3 -3
  99. package/build/utils/get-font-styles-and-weights.cjs +8 -12
  100. package/build/utils/get-font-styles-and-weights.cjs.map +3 -3
  101. package/build/utils/get-px-from-css-unit.cjs +1 -1
  102. package/build/utils/get-px-from-css-unit.cjs.map +1 -1
  103. package/build/utils/index.cjs +1 -1
  104. package/build/utils/index.cjs.map +1 -1
  105. package/build/utils/math.cjs +1 -1
  106. package/build/utils/math.cjs.map +3 -3
  107. package/build/utils/object.cjs +8 -8
  108. package/build/utils/object.cjs.map +3 -3
  109. package/build/utils/order-inserter-block-items.cjs +1 -1
  110. package/build/utils/order-inserter-block-items.cjs.map +3 -3
  111. package/build/utils/pasting.cjs +4 -2
  112. package/build/utils/pasting.cjs.map +3 -3
  113. package/build/utils/selection.cjs +2 -1
  114. package/build/utils/selection.cjs.map +3 -3
  115. package/build/utils/sorting.cjs +9 -3
  116. package/build/utils/sorting.cjs.map +3 -3
  117. package/build/utils/transform-styles/index.cjs +3 -2
  118. package/build/utils/transform-styles/index.cjs.map +3 -3
  119. package/build/utils/transform-styles/postcss-urlrebase.d.cjs +2 -0
  120. package/build/utils/transform-styles/postcss-urlrebase.d.cjs.map +7 -0
  121. package/build/utils/transform-styles/types.cjs +19 -0
  122. package/build/utils/transform-styles/types.cjs.map +7 -0
  123. package/build/utils/types.cjs +19 -0
  124. package/build/utils/types.cjs.map +7 -0
  125. package/build-module/components/block-editing-mode/index.mjs +14 -8
  126. package/build-module/components/block-editing-mode/index.mjs.map +2 -2
  127. package/build-module/components/block-inspector/index.mjs +50 -51
  128. package/build-module/components/block-inspector/index.mjs.map +2 -2
  129. package/build-module/components/block-rename/modal.mjs +0 -1
  130. package/build-module/components/block-rename/modal.mjs.map +2 -2
  131. package/build-module/components/block-toolbar/block-toolbar-icon.mjs +14 -6
  132. package/build-module/components/block-toolbar/block-toolbar-icon.mjs.map +2 -2
  133. package/build-module/components/colors-gradients/control.mjs +27 -15
  134. package/build-module/components/colors-gradients/control.mjs.map +2 -2
  135. package/build-module/components/colors-gradients/dropdown.mjs +4 -1
  136. package/build-module/components/colors-gradients/dropdown.mjs.map +2 -2
  137. package/build-module/components/contrast-checker/index.mjs +18 -4
  138. package/build-module/components/contrast-checker/index.mjs.map +2 -2
  139. package/build-module/components/date-format-picker/index.mjs +0 -1
  140. package/build-module/components/date-format-picker/index.mjs.map +2 -2
  141. package/build-module/components/global-styles/background-panel.mjs +155 -27
  142. package/build-module/components/global-styles/background-panel.mjs.map +2 -2
  143. package/build-module/components/global-styles/color-gradient-dropdown-item.mjs +207 -0
  144. package/build-module/components/global-styles/color-gradient-dropdown-item.mjs.map +7 -0
  145. package/build-module/components/global-styles/color-panel.mjs +106 -387
  146. package/build-module/components/global-styles/color-panel.mjs.map +3 -3
  147. package/build-module/components/global-styles/dimensions-panel.mjs +0 -3
  148. package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
  149. package/build-module/components/global-styles/hooks.mjs +33 -0
  150. package/build-module/components/global-styles/hooks.mjs.map +2 -2
  151. package/build-module/components/global-styles/typography-panel.mjs +84 -10
  152. package/build-module/components/global-styles/typography-panel.mjs.map +2 -2
  153. package/build-module/components/inspector-controls/groups.mjs +2 -0
  154. package/build-module/components/inspector-controls/groups.mjs.map +2 -2
  155. package/build-module/components/inspector-controls-tabs/styles-tab.mjs +75 -31
  156. package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
  157. package/build-module/components/link-control/index.mjs +1 -2
  158. package/build-module/components/link-control/index.mjs.map +2 -2
  159. package/build-module/components/list-view/block-select-button.mjs +2 -17
  160. package/build-module/components/list-view/block-select-button.mjs.map +2 -2
  161. package/build-module/components/provider/use-block-sync.mjs +3 -1
  162. package/build-module/components/provider/use-block-sync.mjs.map +2 -2
  163. package/build-module/components/url-popover/image-url-input-ui.mjs +0 -2
  164. package/build-module/components/url-popover/image-url-input-ui.mjs.map +2 -2
  165. package/build-module/components/use-block-display-information/index.mjs +10 -3
  166. package/build-module/components/use-block-display-information/index.mjs.map +2 -2
  167. package/build-module/components/use-resize-canvas/index.mjs +6 -53
  168. package/build-module/components/use-resize-canvas/index.mjs.map +2 -2
  169. package/build-module/hooks/anchor.mjs +0 -1
  170. package/build-module/hooks/anchor.mjs.map +2 -2
  171. package/build-module/hooks/background.mjs +123 -75
  172. package/build-module/hooks/background.mjs.map +2 -2
  173. package/build-module/hooks/color.mjs +2 -175
  174. package/build-module/hooks/color.mjs.map +2 -2
  175. package/build-module/hooks/contrast-checker.mjs +32 -19
  176. package/build-module/hooks/contrast-checker.mjs.map +2 -2
  177. package/build-module/hooks/custom-class-name.mjs +0 -1
  178. package/build-module/hooks/custom-class-name.mjs.map +2 -2
  179. package/build-module/hooks/elements.mjs +115 -0
  180. package/build-module/hooks/elements.mjs.map +7 -0
  181. package/build-module/hooks/grid-visualizer.mjs +21 -11
  182. package/build-module/hooks/grid-visualizer.mjs.map +2 -2
  183. package/build-module/hooks/layout-child.mjs +41 -8
  184. package/build-module/hooks/layout-child.mjs.map +2 -2
  185. package/build-module/hooks/layout.mjs +6 -3
  186. package/build-module/hooks/layout.mjs.map +2 -2
  187. package/build-module/hooks/states.mjs +15 -23
  188. package/build-module/hooks/states.mjs.map +2 -2
  189. package/build-module/hooks/style.mjs +9 -5
  190. package/build-module/hooks/style.mjs.map +2 -2
  191. package/build-module/hooks/typography.mjs +62 -10
  192. package/build-module/hooks/typography.mjs.map +2 -2
  193. package/build-module/layouts/flex.mjs +105 -7
  194. package/build-module/layouts/flex.mjs.map +2 -2
  195. package/build-module/private-apis.mjs +0 -2
  196. package/build-module/private-apis.mjs.map +2 -2
  197. package/build-module/store/private-actions.mjs +14 -0
  198. package/build-module/store/private-actions.mjs.map +2 -2
  199. package/build-module/store/private-keys.mjs +0 -2
  200. package/build-module/store/private-keys.mjs.map +2 -2
  201. package/build-module/store/private-selectors.mjs +22 -6
  202. package/build-module/store/private-selectors.mjs.map +2 -2
  203. package/build-module/store/reducer.mjs +17 -3
  204. package/build-module/store/reducer.mjs.map +2 -2
  205. package/build-module/utils/block-bindings.mjs +9 -9
  206. package/build-module/utils/block-bindings.mjs.map +3 -3
  207. package/build-module/utils/color-values.mjs +9 -1
  208. package/build-module/utils/color-values.mjs.map +3 -3
  209. package/build-module/utils/dom.mjs +2 -5
  210. package/build-module/utils/dom.mjs.map +3 -3
  211. package/build-module/utils/fit-text-frontend.mjs +6 -2
  212. package/build-module/utils/fit-text-frontend.mjs.map +3 -3
  213. package/build-module/utils/fit-text-utils.mjs +1 -1
  214. package/build-module/utils/fit-text-utils.mjs.map +3 -3
  215. package/build-module/utils/format-font-style.mjs +1 -1
  216. package/build-module/utils/format-font-style.mjs.map +3 -3
  217. package/build-module/utils/format-font-weight.mjs +1 -1
  218. package/build-module/utils/format-font-weight.mjs.map +3 -3
  219. package/build-module/utils/get-editor-region.mjs +4 -2
  220. package/build-module/utils/get-editor-region.mjs.map +3 -3
  221. package/build-module/utils/get-font-styles-and-weights.mjs +8 -12
  222. package/build-module/utils/get-font-styles-and-weights.mjs.map +3 -3
  223. package/build-module/utils/get-px-from-css-unit.mjs +1 -1
  224. package/build-module/utils/get-px-from-css-unit.mjs.map +1 -1
  225. package/build-module/utils/index.mjs +1 -1
  226. package/build-module/utils/index.mjs.map +1 -1
  227. package/build-module/utils/math.mjs +1 -1
  228. package/build-module/utils/math.mjs.map +3 -3
  229. package/build-module/utils/object.mjs +8 -8
  230. package/build-module/utils/object.mjs.map +3 -3
  231. package/build-module/utils/order-inserter-block-items.mjs +1 -1
  232. package/build-module/utils/order-inserter-block-items.mjs.map +3 -3
  233. package/build-module/utils/pasting.mjs +4 -2
  234. package/build-module/utils/pasting.mjs.map +3 -3
  235. package/build-module/utils/selection.mjs +2 -1
  236. package/build-module/utils/selection.mjs.map +3 -3
  237. package/build-module/utils/sorting.mjs +9 -3
  238. package/build-module/utils/sorting.mjs.map +3 -3
  239. package/build-module/utils/transform-styles/index.mjs +3 -2
  240. package/build-module/utils/transform-styles/index.mjs.map +3 -3
  241. package/build-module/utils/transform-styles/postcss-urlrebase.d.mjs +1 -0
  242. package/build-module/utils/transform-styles/postcss-urlrebase.d.mjs.map +7 -0
  243. package/build-module/utils/transform-styles/types.mjs +1 -0
  244. package/build-module/utils/transform-styles/types.mjs.map +7 -0
  245. package/build-module/utils/types.mjs +1 -0
  246. package/build-module/utils/types.mjs.map +7 -0
  247. package/build-style/content-rtl.css +2 -0
  248. package/build-style/content.css +2 -0
  249. package/build-style/style-rtl.css +34 -41
  250. package/build-style/style.css +34 -41
  251. package/build-types/utils/block-bindings.d.ts +27 -0
  252. package/build-types/utils/block-bindings.d.ts.map +1 -0
  253. package/build-types/utils/color-values.d.ts +40 -0
  254. package/build-types/utils/color-values.d.ts.map +1 -0
  255. package/build-types/utils/dom.d.ts +19 -19
  256. package/build-types/utils/dom.d.ts.map +1 -1
  257. package/build-types/utils/fit-text-frontend.d.ts +7 -0
  258. package/build-types/utils/fit-text-frontend.d.ts.map +1 -0
  259. package/build-types/utils/fit-text-utils.d.ts +15 -0
  260. package/build-types/utils/fit-text-utils.d.ts.map +1 -0
  261. package/build-types/utils/format-font-style.d.ts +12 -0
  262. package/build-types/utils/format-font-style.d.ts.map +1 -0
  263. package/build-types/utils/format-font-weight.d.ts +12 -0
  264. package/build-types/utils/format-font-weight.d.ts.map +1 -0
  265. package/build-types/utils/get-editor-region.d.ts +9 -0
  266. package/build-types/utils/get-editor-region.d.ts.map +1 -0
  267. package/build-types/utils/get-font-styles-and-weights.d.ts +16 -0
  268. package/build-types/utils/get-font-styles-and-weights.d.ts.map +1 -0
  269. package/build-types/utils/get-px-from-css-unit.d.ts +10 -0
  270. package/build-types/utils/get-px-from-css-unit.d.ts.map +1 -0
  271. package/build-types/utils/index.d.ts +3 -0
  272. package/build-types/utils/index.d.ts.map +1 -0
  273. package/build-types/utils/math.d.ts +61 -0
  274. package/build-types/utils/math.d.ts.map +1 -0
  275. package/build-types/utils/object.d.ts +39 -0
  276. package/build-types/utils/object.d.ts.map +1 -0
  277. package/build-types/utils/order-inserter-block-items.d.ts +13 -0
  278. package/build-types/utils/order-inserter-block-items.d.ts.map +1 -0
  279. package/build-types/utils/pasting.d.ts +28 -0
  280. package/build-types/utils/pasting.d.ts.map +1 -0
  281. package/build-types/utils/selection.d.ts +21 -0
  282. package/build-types/utils/selection.d.ts.map +1 -0
  283. package/build-types/utils/sorting.d.ts +17 -0
  284. package/build-types/utils/sorting.d.ts.map +1 -0
  285. package/build-types/utils/transform-styles/index.d.ts +15 -0
  286. package/build-types/utils/transform-styles/index.d.ts.map +1 -0
  287. package/build-types/utils/transform-styles/types.d.ts +13 -0
  288. package/build-types/utils/transform-styles/types.d.ts.map +1 -0
  289. package/build-types/utils/types.d.ts +28 -0
  290. package/build-types/utils/types.d.ts.map +1 -0
  291. package/package.json +40 -39
  292. package/src/components/alignment-control/test/__snapshots__/index.js.snap +6 -0
  293. package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +5 -0
  294. package/src/components/block-editing-mode/index.js +17 -9
  295. package/src/components/block-icon/test/__snapshots__/index.js.snap +1 -0
  296. package/src/components/block-inspector/index.js +43 -53
  297. package/src/components/block-rename/modal.js +0 -1
  298. package/src/components/block-toolbar/block-toolbar-icon.js +22 -6
  299. package/src/components/block-toolbar/test/block-toolbar-icon.js +99 -0
  300. package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +4 -0
  301. package/src/components/colors-gradients/control.js +29 -12
  302. package/src/components/colors-gradients/dropdown.js +4 -1
  303. package/src/components/colors-gradients/style.scss +39 -2
  304. package/src/components/contrast-checker/README.md +9 -0
  305. package/src/components/contrast-checker/index.js +42 -3
  306. package/src/components/date-format-picker/index.js +0 -1
  307. package/src/components/default-block-appender/content.scss +3 -0
  308. package/src/components/global-styles/background-panel.js +201 -34
  309. package/src/components/global-styles/color-gradient-dropdown-item.js +258 -0
  310. package/src/components/global-styles/color-panel.js +125 -487
  311. package/src/components/global-styles/dimensions-panel.js +0 -3
  312. package/src/components/global-styles/hooks.js +45 -0
  313. package/src/components/global-styles/test/background-panel.js +56 -0
  314. package/src/components/global-styles/test/color-panel.js +172 -118
  315. package/src/components/global-styles/test/typography-panel.js +167 -0
  316. package/src/components/global-styles/typography-panel.js +100 -11
  317. package/src/components/inspector-controls/README.md +0 -2
  318. package/src/components/inspector-controls/groups.js +2 -0
  319. package/src/components/inspector-controls-tabs/styles-tab.js +74 -28
  320. package/src/components/link-control/index.js +0 -1
  321. package/src/components/link-control/test/index.js +2 -3
  322. package/src/components/list-view/block-select-button.js +2 -17
  323. package/src/components/provider/use-block-sync.js +3 -1
  324. package/src/components/rich-text/content.scss +2 -0
  325. package/src/components/url-popover/image-url-input-ui.js +0 -2
  326. package/src/components/use-block-display-information/index.js +15 -2
  327. package/src/components/use-block-display-information/test/index.js +140 -0
  328. package/src/components/use-resize-canvas/index.js +10 -71
  329. package/src/hooks/anchor.js +0 -1
  330. package/src/hooks/background.js +210 -133
  331. package/src/hooks/background.scss +0 -35
  332. package/src/hooks/color.js +2 -205
  333. package/src/hooks/color.scss +3 -9
  334. package/src/hooks/contrast-checker.js +60 -17
  335. package/src/hooks/custom-class-name.js +0 -1
  336. package/src/hooks/elements.js +140 -0
  337. package/src/hooks/elements.scss +8 -0
  338. package/src/hooks/grid-visualizer.js +59 -45
  339. package/src/hooks/layout-child.js +51 -12
  340. package/src/hooks/layout.js +6 -3
  341. package/src/hooks/states.js +32 -28
  342. package/src/hooks/style.js +11 -7
  343. package/src/hooks/test/background.js +59 -0
  344. package/src/hooks/test/block-style-state.js +14 -14
  345. package/src/hooks/test/layout.js +6 -6
  346. package/src/hooks/test/style.js +8 -8
  347. package/src/hooks/typography.js +70 -6
  348. package/src/layouts/flex.js +118 -15
  349. package/src/private-apis.js +0 -2
  350. package/src/store/private-actions.js +31 -0
  351. package/src/store/private-keys.js +0 -1
  352. package/src/store/private-selectors.js +43 -7
  353. package/src/store/reducer.js +37 -2
  354. package/src/store/test/private-selectors.js +39 -14
  355. package/src/store/test/reducer.js +91 -12
  356. package/src/style.scss +1 -0
  357. package/src/utils/block-bindings.ts +51 -0
  358. package/src/utils/color-values.ts +63 -0
  359. package/src/utils/{dom.js → dom.ts} +27 -27
  360. package/src/utils/{fit-text-frontend.js → fit-text-frontend.ts} +12 -4
  361. package/src/utils/{fit-text-utils.js → fit-text-utils.ts} +15 -7
  362. package/src/utils/{format-font-style.js → format-font-style.ts} +10 -3
  363. package/src/utils/{format-font-weight.js → format-font-weight.ts} +10 -3
  364. package/src/utils/{get-editor-region.js → get-editor-region.ts} +10 -6
  365. package/src/utils/{get-font-styles-and-weights.js → get-font-styles-and-weights.ts} +21 -17
  366. package/src/utils/{math.js → math.ts} +37 -30
  367. package/src/utils/object.ts +89 -0
  368. package/src/utils/{order-inserter-block-items.js → order-inserter-block-items.ts} +8 -5
  369. package/src/utils/{pasting.js → pasting.ts} +18 -11
  370. package/src/utils/{selection.js → selection.ts} +11 -4
  371. package/src/utils/sorting.ts +81 -0
  372. package/src/utils/test/color-values.js +44 -1
  373. package/src/utils/transform-styles/{index.js → index.ts} +25 -25
  374. package/src/utils/transform-styles/postcss-urlrebase.d.ts +15 -0
  375. package/src/utils/transform-styles/types.ts +13 -0
  376. package/src/utils/types.ts +29 -0
  377. package/src/components/use-resize-canvas/README.md +0 -37
  378. package/src/utils/block-bindings.js +0 -46
  379. package/src/utils/color-values.js +0 -28
  380. package/src/utils/object.js +0 -67
  381. package/src/utils/sorting.js +0 -54
  382. /package/src/utils/{get-px-from-css-unit.js → get-px-from-css-unit.ts} +0 -0
  383. /package/src/utils/{index.js → index.ts} +0 -0
@@ -28,6 +28,8 @@ var import_blocks = require("@wordpress/blocks");
28
28
  var import_i18n = require("@wordpress/i18n");
29
29
  var import_icons = require("@wordpress/icons");
30
30
  var import_store = require("../../store/index.cjs");
31
+ var import_lock_unlock = require("../../lock-unlock.cjs");
32
+ var import_private_keys = require("../../store/private-keys.cjs");
31
33
  function getPositionTypeLabel(attributes) {
32
34
  const positionType = attributes?.style?.position?.type;
33
35
  if (positionType === "sticky") {
@@ -44,11 +46,13 @@ function useBlockDisplayInformation(clientId) {
44
46
  if (!clientId) {
45
47
  return null;
46
48
  }
49
+ const blockEditorSelect = select(import_store.store);
47
50
  const {
48
51
  getBlockName,
49
52
  getBlockAttributes,
50
- __experimentalGetParsedPattern
51
- } = select(import_store.store);
53
+ __experimentalGetParsedPattern,
54
+ getSettings
55
+ } = blockEditorSelect;
52
56
  const { getBlockType, getActiveBlockVariation } = select(import_blocks.store);
53
57
  const blockName = getBlockName(clientId);
54
58
  const blockType = getBlockType(blockName);
@@ -56,8 +60,11 @@ function useBlockDisplayInformation(clientId) {
56
60
  return null;
57
61
  }
58
62
  const attributes = getBlockAttributes(clientId);
63
+ const { isWithinEditedContentOnlySection } = (0, import_lock_unlock.unlock)(blockEditorSelect);
64
+ const isIsolatedEditor = !!getSettings()?.[import_private_keys.isIsolatedEditorKey];
59
65
  const patternName = attributes?.metadata?.patternName;
60
- if (patternName) {
66
+ const isEditedContentOnlySection = isWithinEditedContentOnlySection(clientId);
67
+ if (patternName && !isEditedContentOnlySection && !isIsolatedEditor) {
61
68
  const pattern = __experimentalGetParsedPattern(patternName);
62
69
  const positionLabel2 = getPositionTypeLabel(attributes);
63
70
  return {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/use-block-display-information/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tstore as blocksStore,\n\tisReusableBlock,\n\tisTemplatePart,\n\t__experimentalGetBlockLabel as getBlockLabel,\n} from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\nimport { symbol } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/** @typedef {import('@wordpress/blocks').WPIcon} WPIcon */\n\n/**\n * Contains basic block's information for display reasons.\n *\n * @typedef {Object} WPBlockDisplayInformation\n *\n * @property {boolean} isSynced True if is a reusable block or template part\n * @property {string} title Human-readable block type label.\n * @property {WPIcon} icon Block type icon.\n * @property {string} description A detailed block type description.\n * @property {string} anchor HTML anchor.\n * @property {name} name A custom, human readable name for the block.\n */\n\n/**\n * Get the display label for a block's position type.\n *\n * @param {Object} attributes Block attributes.\n * @return {string} The position type label.\n */\nfunction getPositionTypeLabel( attributes ) {\n\tconst positionType = attributes?.style?.position?.type;\n\n\tif ( positionType === 'sticky' ) {\n\t\treturn __( 'Sticky' );\n\t}\n\n\tif ( positionType === 'fixed' ) {\n\t\treturn __( 'Fixed' );\n\t}\n\n\treturn null;\n}\n\n/**\n * Hook used to try to find a matching block variation and return\n * the appropriate information for display reasons. In order to\n * to try to find a match we need to things:\n * 1. Block's client id to extract it's current attributes.\n * 2. A block variation should have set `isActive` prop to a proper function.\n *\n * If for any reason a block variation match cannot be found,\n * the returned information come from the Block Type.\n * If no blockType is found with the provided clientId, returns null.\n *\n * @param {string} clientId Block's client id.\n * @return {?WPBlockDisplayInformation} Block's display information, or `null` when the block or its type not found.\n */\n\nexport default function useBlockDisplayInformation( clientId ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst {\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\t__experimentalGetParsedPattern,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { getBlockType, getActiveBlockVariation } =\n\t\t\t\tselect( blocksStore );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst blockType = getBlockType( blockName );\n\t\t\tif ( ! blockType ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst attributes = getBlockAttributes( clientId );\n\n\t\t\t// Check if this block is a pattern\n\t\t\tconst patternName = attributes?.metadata?.patternName;\n\n\t\t\tif ( patternName ) {\n\t\t\t\tconst pattern = __experimentalGetParsedPattern( patternName );\n\t\t\t\tconst positionLabel = getPositionTypeLabel( attributes );\n\t\t\t\treturn {\n\t\t\t\t\tisSynced: false,\n\t\t\t\t\ttitle: __( 'Pattern' ),\n\t\t\t\t\ticon: symbol,\n\t\t\t\t\tdescription:\n\t\t\t\t\t\tpattern?.description || __( 'A block pattern.' ),\n\t\t\t\t\tanchor: attributes?.anchor,\n\t\t\t\t\tpositionLabel,\n\t\t\t\t\tpositionType: attributes?.style?.position?.type,\n\t\t\t\t\tname: pattern?.title || attributes?.metadata?.name,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst match = getActiveBlockVariation( blockName, attributes );\n\t\t\tconst isSynced =\n\t\t\t\tisReusableBlock( blockType ) || isTemplatePart( blockType );\n\t\t\tconst syncedTitle = isSynced\n\t\t\t\t? getBlockLabel( blockType, attributes )\n\t\t\t\t: undefined;\n\t\t\tconst title = syncedTitle || blockType.title;\n\t\t\tconst positionLabel = getPositionTypeLabel( attributes );\n\t\t\tconst blockTypeInfo = {\n\t\t\t\tisSynced,\n\t\t\t\ttitle,\n\t\t\t\ticon: blockType.icon,\n\t\t\t\tdescription: blockType.description,\n\t\t\t\tanchor: attributes?.anchor,\n\t\t\t\tpositionLabel,\n\t\t\t\tpositionType: attributes?.style?.position?.type,\n\t\t\t\tname: attributes?.metadata?.name,\n\t\t\t};\n\t\t\tif ( ! match ) {\n\t\t\t\treturn blockTypeInfo;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tisSynced,\n\t\t\t\ttitle: match.title || blockType.title,\n\t\t\t\ticon: match.icon || blockType.icon,\n\t\t\t\tdescription: match.description || blockType.description,\n\t\t\t\tanchor: attributes?.anchor,\n\t\t\t\tpositionLabel,\n\t\t\t\tpositionType: attributes?.style?.position?.type,\n\t\t\t\tname: attributes?.metadata?.name,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA0B;AAC1B,oBAKO;AACP,kBAAmB;AACnB,mBAAuB;AAKvB,mBAA0C;AAuB1C,SAAS,qBAAsB,YAAa;AAC3C,QAAM,eAAe,YAAY,OAAO,UAAU;AAElD,MAAK,iBAAiB,UAAW;AAChC,eAAO,gBAAI,QAAS;AAAA,EACrB;AAEA,MAAK,iBAAiB,SAAU;AAC/B,eAAO,gBAAI,OAAQ;AAAA,EACpB;AAEA,SAAO;AACR;AAiBe,SAAR,2BAA6C,UAAW;AAC9D,aAAO;AAAA,IACN,CAAE,WAAY;AACb,UAAK,CAAE,UAAW;AACjB,eAAO;AAAA,MACR;AACA,YAAM;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,MACD,IAAI,OAAQ,a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AA,QACpB;AAAA,QACA,cAAc,YAAY,OAAO,UAAU;AAAA,QAC3C,MAAM,YAAY,UAAU;AAAA,MAC7B;AAAA,IACD;AAAA,IACA,CAAE,QAAS;AAAA,EACZ;AACD;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tstore as blocksStore,\n\tisReusableBlock,\n\tisTemplatePart,\n\t__experimentalGetBlockLabel as getBlockLabel,\n} from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\nimport { symbol } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { isIsolatedEditorKey } from '../../store/private-keys';\n\n/** @typedef {import('@wordpress/blocks').WPIcon} WPIcon */\n\n/**\n * Contains basic block's information for display reasons.\n *\n * @typedef {Object} WPBlockDisplayInformation\n *\n * @property {boolean} isSynced True if is a reusable block or template part\n * @property {string} title Human-readable block type label.\n * @property {WPIcon} icon Block type icon.\n * @property {string} description A detailed block type description.\n * @property {string} anchor HTML anchor.\n * @property {name} name A custom, human readable name for the block.\n */\n\n/**\n * Get the display label for a block's position type.\n *\n * @param {Object} attributes Block attributes.\n * @return {string} The position type label.\n */\nfunction getPositionTypeLabel( attributes ) {\n\tconst positionType = attributes?.style?.position?.type;\n\n\tif ( positionType === 'sticky' ) {\n\t\treturn __( 'Sticky' );\n\t}\n\n\tif ( positionType === 'fixed' ) {\n\t\treturn __( 'Fixed' );\n\t}\n\n\treturn null;\n}\n\n/**\n * Hook used to try to find a matching block variation and return\n * the appropriate information for display reasons. In order to\n * to try to find a match we need to things:\n * 1. Block's client id to extract it's current attributes.\n * 2. A block variation should have set `isActive` prop to a proper function.\n *\n * If for any reason a block variation match cannot be found,\n * the returned information come from the Block Type.\n * If no blockType is found with the provided clientId, returns null.\n *\n * @param {string} clientId Block's client id.\n * @return {?WPBlockDisplayInformation} Block's display information, or `null` when the block or its type not found.\n */\n\nexport default function useBlockDisplayInformation( clientId ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst blockEditorSelect = select( blockEditorStore );\n\t\t\tconst {\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\t__experimentalGetParsedPattern,\n\t\t\t\tgetSettings,\n\t\t\t} = blockEditorSelect;\n\t\t\tconst { getBlockType, getActiveBlockVariation } =\n\t\t\t\tselect( blocksStore );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst blockType = getBlockType( blockName );\n\t\t\tif ( ! blockType ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\tconst { isWithinEditedContentOnlySection } =\n\t\t\t\tunlock( blockEditorSelect );\n\t\t\tconst isIsolatedEditor = !! getSettings()?.[ isIsolatedEditorKey ];\n\n\t\t\t// Check if this block is a pattern\n\t\t\tconst patternName = attributes?.metadata?.patternName;\n\t\t\tconst isEditedContentOnlySection =\n\t\t\t\tisWithinEditedContentOnlySection( clientId );\n\n\t\t\tif (\n\t\t\t\tpatternName &&\n\t\t\t\t! isEditedContentOnlySection &&\n\t\t\t\t! isIsolatedEditor\n\t\t\t) {\n\t\t\t\tconst pattern = __experimentalGetParsedPattern( patternName );\n\t\t\t\tconst positionLabel = getPositionTypeLabel( attributes );\n\t\t\t\treturn {\n\t\t\t\t\tisSynced: false,\n\t\t\t\t\ttitle: __( 'Pattern' ),\n\t\t\t\t\ticon: symbol,\n\t\t\t\t\tdescription:\n\t\t\t\t\t\tpattern?.description || __( 'A block pattern.' ),\n\t\t\t\t\tanchor: attributes?.anchor,\n\t\t\t\t\tpositionLabel,\n\t\t\t\t\tpositionType: attributes?.style?.position?.type,\n\t\t\t\t\tname: pattern?.title || attributes?.metadata?.name,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst match = getActiveBlockVariation( blockName, attributes );\n\t\t\tconst isSynced =\n\t\t\t\tisReusableBlock( blockType ) || isTemplatePart( blockType );\n\t\t\tconst syncedTitle = isSynced\n\t\t\t\t? getBlockLabel( blockType, attributes )\n\t\t\t\t: undefined;\n\t\t\tconst title = syncedTitle || blockType.title;\n\t\t\tconst positionLabel = getPositionTypeLabel( attributes );\n\t\t\tconst blockTypeInfo = {\n\t\t\t\tisSynced,\n\t\t\t\ttitle,\n\t\t\t\ticon: blockType.icon,\n\t\t\t\tdescription: blockType.description,\n\t\t\t\tanchor: attributes?.anchor,\n\t\t\t\tpositionLabel,\n\t\t\t\tpositionType: attributes?.style?.position?.type,\n\t\t\t\tname: attributes?.metadata?.name,\n\t\t\t};\n\t\t\tif ( ! match ) {\n\t\t\t\treturn blockTypeInfo;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tisSynced,\n\t\t\t\ttitle: match.title || blockType.title,\n\t\t\t\ticon: match.icon || blockType.icon,\n\t\t\t\tdescription: match.description || blockType.description,\n\t\t\t\tanchor: attributes?.anchor,\n\t\t\t\tpositionLabel,\n\t\t\t\tpositionType: attributes?.style?.position?.type,\n\t\t\t\tname: attributes?.metadata?.name,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA0B;AAC1B,oBAKO;AACP,kBAAmB;AACnB,mBAAuB;AAKvB,mBAA0C;AAC1C,yBAAuB;AACvB,0BAAoC;AAuBpC,SAAS,qBAAsB,YAAa;AAC3C,QAAM,eAAe,YAAY,OAAO,UAAU;AAElD,MAAK,iBAAiB,UAAW;AAChC,eAAO,gBAAI,QAAS;AAAA,EACrB;AAEA,MAAK,iBAAiB,SAAU;AAC/B,eAAO,gBAAI,OAAQ;AAAA,EACpB;AAEA,SAAO;AACR;AAiBe,SAAR,2BAA6C,UAAW;AAC9D,aAAO;AAAA,IACN,CAAE,WAAY;AACb,UAAK,CAAE,UAAW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QACA,cAAc,YAAY,OAAO,UAAU;AAAA,QAC3C,MAAM,YAAY,UAAU;AAAA,MAC7B;AACA,UAAK,CAAE,OAAQ;AACd,eAAO;AAAA,MACR;AAEA,aAAO;AAAA,QACN;AAAA,QACA,OAAO,MAAM,SAAS,UAAU;AAAA,QAChC,MAAM,MAAM,QAAQ,UAAU;AAAA,QAC9B,aAAa,MAAM,eAAe,UAAU;AAAA,QAC5C,QAAQ,YAAY;AAAA,QACpB;AAAA,QACA,cAAc,YAAY,OAAO,UAAU;AAAA,QAC3C,MAAM,YAAY,UAAU;AAAA,MAC7B;AAAA,IACD;AAAA,IACA,CAAE,QAAS;AAAA,EACZ;AACD;",
6
6
  "names": ["blockEditorStore", "blocksStore", "positionLabel", "getBlockLabel"]
7
7
  }
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // packages/block-editor/src/components/use-resize-canvas/index.js
@@ -23,58 +33,11 @@ __export(use_resize_canvas_exports, {
23
33
  default: () => useResizeCanvas
24
34
  });
25
35
  module.exports = __toCommonJS(use_resize_canvas_exports);
26
- var import_element = require("@wordpress/element");
27
- function useResizeCanvas(deviceType) {
28
- const [actualWidth, updateActualWidth] = (0, import_element.useState)(window.innerWidth);
29
- (0, import_element.useEffect)(() => {
30
- if (deviceType === "Desktop") {
31
- return;
32
- }
33
- const resizeListener = () => updateActualWidth(window.innerWidth);
34
- window.addEventListener("resize", resizeListener);
35
- return () => {
36
- window.removeEventListener("resize", resizeListener);
37
- };
38
- }, [deviceType]);
39
- const getCanvasWidth = (device) => {
40
- let deviceWidth;
41
- switch (device) {
42
- case "Tablet":
43
- deviceWidth = 782 - 1;
44
- break;
45
- case "Mobile":
46
- deviceWidth = 480 - 1;
47
- break;
48
- default:
49
- return null;
50
- }
51
- return deviceWidth < actualWidth ? deviceWidth : actualWidth;
52
- };
53
- const contentInlineStyles = (device) => {
54
- const height = device === "Mobile" ? "768px" : "1024px";
55
- const marginVertical = "40px";
56
- const marginHorizontal = "auto";
57
- switch (device) {
58
- case "Tablet":
59
- case "Mobile":
60
- return {
61
- width: getCanvasWidth(device),
62
- // Keeping margin styles separate to avoid warnings
63
- // when those props get overridden in the iframe component
64
- marginTop: marginVertical,
65
- marginBottom: marginVertical,
66
- marginLeft: marginHorizontal,
67
- marginRight: marginHorizontal,
68
- height,
69
- overflowY: "auto"
70
- };
71
- default:
72
- return {
73
- marginLeft: marginHorizontal,
74
- marginRight: marginHorizontal
75
- };
76
- }
77
- };
78
- return contentInlineStyles(deviceType);
36
+ var import_deprecated = __toESM(require("@wordpress/deprecated"));
37
+ function useResizeCanvas() {
38
+ (0, import_deprecated.default)("wp.blockEditor.useResizeCanvas", {
39
+ since: "7.1",
40
+ hint: "Device preview is now handled by the editor canvas. This hook no longer does anything."
41
+ });
79
42
  }
80
43
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/use-resize-canvas/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\n\n/**\n * Function to resize the editor window.\n *\n * @param {string} deviceType Used for determining the size of the container (e.g. Desktop, Tablet, Mobile)\n *\n * @return {Object} Inline styles to be added to resizable container.\n */\nexport default function useResizeCanvas( deviceType ) {\n\tconst [ actualWidth, updateActualWidth ] = useState( window.innerWidth );\n\n\tuseEffect( () => {\n\t\tif ( deviceType === 'Desktop' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst resizeListener = () => updateActualWidth( window.innerWidth );\n\t\twindow.addEventListener( 'resize', resizeListener );\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener( 'resize', resizeListener );\n\t\t};\n\t}, [ deviceType ] );\n\n\tconst getCanvasWidth = ( device ) => {\n\t\tlet deviceWidth;\n\n\t\t/*\n\t\t * Matches the breakpoints in packages/base-styles/_breakpoints.scss,\n\t\t * and breakpoints in packages/compose/src/hooks/use-viewport-match/index.js.\n\t\t * minus 1 to trigger the media query for device preview.\n\t\t */\n\t\tswitch ( device ) {\n\t\t\tcase 'Tablet':\n\t\t\t\tdeviceWidth = 782 - 1; // preview for useViewportMatch( 'medium', '<' )\n\t\t\t\tbreak;\n\t\t\tcase 'Mobile':\n\t\t\t\tdeviceWidth = 480 - 1; // preview for useViewportMatch( 'mobile', '<' )\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn null;\n\t\t}\n\n\t\treturn deviceWidth < actualWidth ? deviceWidth : actualWidth;\n\t};\n\n\tconst contentInlineStyles = ( device ) => {\n\t\tconst height = device === 'Mobile' ? '768px' : '1024px';\n\t\tconst marginVertical = '40px';\n\t\tconst marginHorizontal = 'auto';\n\n\t\tswitch ( device ) {\n\t\t\tcase 'Tablet':\n\t\t\tcase 'Mobile':\n\t\t\t\treturn {\n\t\t\t\t\twidth: getCanvasWidth( device ),\n\t\t\t\t\t// Keeping margin styles separate to avoid warnings\n\t\t\t\t\t// when those props get overridden in the iframe component\n\t\t\t\t\tmarginTop: marginVertical,\n\t\t\t\t\tmarginBottom: marginVertical,\n\t\t\t\t\tmarginLeft: marginHorizontal,\n\t\t\t\t\tmarginRight: marginHorizontal,\n\t\t\t\t\theight,\n\t\t\t\t\toverflowY: 'auto',\n\t\t\t\t};\n\t\t\tdefault:\n\t\t\t\treturn {\n\t\t\t\t\tmarginLeft: marginHorizontal,\n\t\t\t\t\tmarginRight: marginHorizontal,\n\t\t\t\t};\n\t\t}\n\t};\n\n\treturn contentInlineStyles( deviceType );\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAoC;AASrB,SAAR,gBAAkC,YAAa;AACrD,QAAM,CAAE,aAAa,iBAAkB,QAAI,yBAAU,OAAO,UAAW;AAEvE,gCAAW,MAAM;AAChB,QAAK,eAAe,WAAY;AAC/B;AAAA,IACD;AAEA,UAAM,iBAAiB,MAAM,kBAAmB,OAAO,UAAW;AAClE,WAAO,iBAAkB,UAAU,cAAe;AAElD,WAAO,MAAM;AACZ,aAAO,oBAAqB,UAAU,cAAe;AAAA,IACtD;AAAA,EACD,GAAG,CAAE,UAAW,CAAE;AAElB,QAAM,iBAAiB,CAAE,WAAY;AACpC,QAAI;AAOJ,YAAS,QAAS;AAAA,MACjB,KAAK;AACJ,sBAAc,MAAM;AACpB;AAAA,MACD,KAAK;AACJ,sBAAc,MAAM;AACpB;AAAA,MACD;AACC,eAAO;AAAA,IACT;AAEA,WAAO,cAAc,cAAc,cAAc;AAAA,EAClD;AAEA,QAAM,sBAAsB,CAAE,WAAY;AACzC,UAAM,SAAS,WAAW,WAAW,UAAU;AAC/C,UAAM,iBAAiB;AACvB,UAAM,mBAAmB;AAEzB,YAAS,QAAS;AAAA,MACjB,KAAK;AAAA,MACL,KAAK;AACJ,eAAO;AAAA,UACN,OAAO,eAAgB,MAAO;AAAA;AAAA;AAAA,UAG9B,WAAW;AAAA,UACX,cAAc;AAAA,UACd,YAAY;AAAA,UACZ,aAAa;AAAA,UACb;AAAA,UACA,WAAW;AAAA,QACZ;AAAA,MACD;AACC,eAAO;AAAA,UACN,YAAY;AAAA,UACZ,aAAa;AAAA,QACd;AAAA,IACF;AAAA,EACD;AAEA,SAAO,oBAAqB,UAAW;AACxC;",
6
- "names": []
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Previously returned inline styles that sized the editor canvas to emulate a\n * device preview width. Device preview is now handled by the editor's resizable\n * canvas, so this hook is a no-op kept for backward compatibility.\n *\n * @deprecated\n */\nexport default function useResizeCanvas() {\n\tdeprecated( 'wp.blockEditor.useResizeCanvas', {\n\t\tsince: '7.1',\n\t\thint: 'Device preview is now handled by the editor canvas. This hook no longer does anything.',\n\t} );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAuB;AASR,SAAR,kBAAmC;AACzC,wBAAAA,SAAY,kCAAkC;AAAA,IAC7C,OAAO;AAAA,IACP,MAAM;AAAA,EACP,CAAE;AACH;",
6
+ "names": ["deprecated"]
7
7
  }
@@ -55,7 +55,6 @@ function BlockEditAnchorControlPure({ anchor, setAttributes }) {
55
55
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components2.InspectorControls, { group: "advanced", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
56
56
  import_components.TextControl,
57
57
  {
58
- __next40pxDefaultSize: true,
59
58
  className: "html-anchor-control",
60
59
  label: (0, import_i18n.__)("HTML anchor"),
61
60
  help: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/hooks/anchor.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { TextControl, ExternalLink } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { InspectorControls } from '../components';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\n/**\n * Regular expression matching invalid anchor characters for replacement.\n *\n * @type {RegExp}\n */\nconst ANCHOR_REGEX = /[\\s#]/g;\n\n/**\n * Filters registered block settings, extending attributes with anchor using ID\n * of the first node.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( 'type' in ( settings.attributes?.anchor ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, 'anchor' ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tanchor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockEditAnchorControlPure( { anchor, setAttributes } ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t<TextControl\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tclassName=\"html-anchor-control\"\n\t\t\t\tlabel={ __( 'HTML anchor' ) }\n\t\t\t\thelp={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Enter a word or two—without spaces—to make a unique web address just for this block, called an “anchor”. Then, you’ll be able to link directly to this section of your page.'\n\t\t\t\t\t\t) }{ ' ' }\n\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/page-jumps/'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Learn more about anchors' ) }\n\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tvalue={ anchor || '' }\n\t\t\t\tplaceholder={ null }\n\t\t\t\tonChange={ ( nextValue ) => {\n\t\t\t\t\tnextValue = nextValue.replace( ANCHOR_REGEX, '-' );\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tanchor: nextValue !== '' ? nextValue : undefined,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tautoCapitalize=\"none\"\n\t\t\t\tautoComplete=\"off\"\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n}\n\nexport default {\n\taddSaveProps,\n\tedit: BlockEditAnchorControlPure,\n\tattributeKeys: [ 'anchor' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'anchor' );\n\t},\n};\n\n/**\n * Override props assigned to save component to inject anchor ID, if block\n * supports anchor. This is only applied if the block's save result is an\n * element and not a markup string.\n *\n * @param {Object} extraProps Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Current block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps( extraProps, blockType, attributes ) {\n\tif ( hasBlockSupport( blockType, 'anchor' ) ) {\n\t\textraProps.id = attributes.anchor === '' ? null : attributes.anchor;\n\t}\n\n\treturn extraProps;\n}\n\naddFilter( 'blocks.registerBlockType', 'core/anchor/attribute', addAttribute );\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAA0B;AAC1B,wBAA0C;AAC1C,kBAAmB;AACnB,oBAAgC;AAKhC,IAAAA,qBAAkC;AAClC,gCAAoC;AAiD/B;AA1CL,IAAM,eAAe;AAUd,SAAS,aAAc,UAAW;AAExC,MAAK,WAAY,SAAS,YAAY,UAAU,CAAC,IAAM;AACtD,WAAO;AAAA,EACR;AACA,UAAK,+BAAiB,UAAU,QAAS,GAAI;AAE5C,aAAS,aAAa;AAAA,MACrB,GAAG,SAAS;AAAA,MACZ,QAAQ;AAAA,QACP,MAAM;AAAA,MACP;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR;AAEA,SAAS,2BAA4B,EAAE,QAAQ,cAAc,GAAI;AAChE,QAAM,uBAAmB,+CAAoB;AAE7C,MAAK,qBAAqB,WAAY;AACrC,WAAO;AAAA,EACR;AAEA,SACC,4CAAC,wCAAkB,OAAM,YACxB;AAAA,IAAC;AAAA;AAAA,MACA,uBAAqB;AAAA,MACrB,WAAU;AAAA,MACV,WAAQ,gBAAI,aAAc;AAAA,MAC1B,MACC,4EACG;AAAA;AAAA,UACD;AAAA,QACD;AAAA,QAAK;AAAA,QACL;AAAA,UAAC;AAAA;AAAA,YACA,UAAO;AAAA,cACN;AAAA,YACD;AAAA,YAEE,8BAAI,0BAA2B;AAAA;AAAA,QAClC;AAAA,SACD;AAAA,MAED,OAAQ,UAAU;AAAA,MAClB,aAAc;AAAA,MACd,UAAW,CAAE,cAAe;AAC3B,oBAAY,UAAU,QAAS,cAAc,GAAI;AACjD,sBAAe;AAAA,UACd,QAAQ,cAAc,KAAK,YAAY;AAAA,QACxC,CAAE;AAAA,MACH;AAAA,MACA,gBAAe;AAAA,MACf,cAAa;AAAA;AAAA,EACd,GACD;AAEF;AAEA,IAAO,iBAAQ;AAAA,EACd;AAAA,EACA,MAAM;AAAA,EACN,eAAe,CAAE,QAAS;AAAA,EAC1B,WAAY,MAAO;AAClB,eAAO,+BAAiB,MAAM,QAAS;AAAA,EACxC;AACD;AAaO,SAAS,aAAc,YAAY,WAAW,YAAa;AACjE,UAAK,+BAAiB,WAAW,QAAS,GAAI;AAC7C,eAAW,KAAK,WAAW,WAAW,KAAK,OAAO,WAAW;AAAA,EAC9D;AAEA,SAAO;AACR;AAAA,IAEA,wBAAW,4BAA4B,yBAAyB,YAAa;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { TextControl, ExternalLink } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { InspectorControls } from '../components';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\n/**\n * Regular expression matching invalid anchor characters for replacement.\n *\n * @type {RegExp}\n */\nconst ANCHOR_REGEX = /[\\s#]/g;\n\n/**\n * Filters registered block settings, extending attributes with anchor using ID\n * of the first node.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( 'type' in ( settings.attributes?.anchor ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, 'anchor' ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tanchor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockEditAnchorControlPure( { anchor, setAttributes } ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t<TextControl\n\t\t\t\tclassName=\"html-anchor-control\"\n\t\t\t\tlabel={ __( 'HTML anchor' ) }\n\t\t\t\thelp={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Enter a word or two—without spaces—to make a unique web address just for this block, called an “anchor”. Then, you’ll be able to link directly to this section of your page.'\n\t\t\t\t\t\t) }{ ' ' }\n\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/page-jumps/'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Learn more about anchors' ) }\n\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tvalue={ anchor || '' }\n\t\t\t\tplaceholder={ null }\n\t\t\t\tonChange={ ( nextValue ) => {\n\t\t\t\t\tnextValue = nextValue.replace( ANCHOR_REGEX, '-' );\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tanchor: nextValue !== '' ? nextValue : undefined,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tautoCapitalize=\"none\"\n\t\t\t\tautoComplete=\"off\"\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n}\n\nexport default {\n\taddSaveProps,\n\tedit: BlockEditAnchorControlPure,\n\tattributeKeys: [ 'anchor' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'anchor' );\n\t},\n};\n\n/**\n * Override props assigned to save component to inject anchor ID, if block\n * supports anchor. This is only applied if the block's save result is an\n * element and not a markup string.\n *\n * @param {Object} extraProps Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Current block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps( extraProps, blockType, attributes ) {\n\tif ( hasBlockSupport( blockType, 'anchor' ) ) {\n\t\textraProps.id = attributes.anchor === '' ? null : attributes.anchor;\n\t}\n\n\treturn extraProps;\n}\n\naddFilter( 'blocks.registerBlockType', 'core/anchor/attribute', addAttribute );\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAA0B;AAC1B,wBAA0C;AAC1C,kBAAmB;AACnB,oBAAgC;AAKhC,IAAAA,qBAAkC;AAClC,gCAAoC;AAgD/B;AAzCL,IAAM,eAAe;AAUd,SAAS,aAAc,UAAW;AAExC,MAAK,WAAY,SAAS,YAAY,UAAU,CAAC,IAAM;AACtD,WAAO;AAAA,EACR;AACA,UAAK,+BAAiB,UAAU,QAAS,GAAI;AAE5C,aAAS,aAAa;AAAA,MACrB,GAAG,SAAS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ES,
34
34
  BACKGROUND_SUPPORT_KEY: () => BACKGROUND_SUPPORT_KEY,
35
35
  BackgroundImagePanel: () => BackgroundImagePanel,
36
+ backgroundResetAllFilter: () => backgroundResetAllFilter,
36
37
  default: () => background_default,
37
38
  getBackgroundImageClasses: () => getBackgroundImageClasses,
38
39
  hasBackgroundSupport: () => hasBackgroundSupport,
@@ -42,10 +43,12 @@ module.exports = __toCommonJS(background_exports);
42
43
  var import_clsx = __toESM(require("clsx"));
43
44
  var import_blocks = require("@wordpress/blocks");
44
45
  var import_data = require("@wordpress/data");
45
- var import_element = require("@wordpress/element");
46
+ var import_i18n = require("@wordpress/i18n");
46
47
  var import_inspector_controls = __toESM(require("../components/inspector-controls/index.cjs"));
47
48
  var import_utils = require("./utils.cjs");
49
+ var import_color_values = require("../utils/color-values.cjs");
48
50
  var import_store = require("../store/index.cjs");
51
+ var import_contrast_checker = __toESM(require("./contrast-checker.cjs"));
49
52
  var import_background_panel = __toESM(require("../components/global-styles/background-panel.cjs"));
50
53
  var import_private_keys = require("../store/private-keys.cjs");
51
54
  var import_block_style_state = require("./block-style-state.cjs");
@@ -100,40 +103,46 @@ function useBlockProps({ name, style }) {
100
103
  function getBackgroundImageClasses(style) {
101
104
  return (0, import_background_panel.hasBackgroundImageValue)(style) || (0, import_background_panel.hasBackgroundGradientValue)(style) ? "has-background" : "";
102
105
  }
103
- function BackgroundInspectorControl({
104
- children,
105
- backgroundGradientSupported = false
106
- }) {
107
- const resetAllFilter = (0, import_element.useCallback)(
108
- (attributes) => {
109
- const updatedClassName = attributes.className?.includes(
110
- "has-background"
111
- ) ? attributes.className.split(" ").filter((c) => c !== "has-background").join(" ") || void 0 : attributes.className;
112
- return {
113
- ...attributes,
114
- className: updatedClassName,
115
- style: (0, import_utils.cleanEmptyObject)({
116
- ...attributes.style,
117
- background: void 0,
118
- color: backgroundGradientSupported ? {
119
- ...attributes.style?.color,
120
- gradient: void 0
121
- } : attributes.style?.color
122
- })
123
- };
124
- },
125
- [backgroundGradientSupported]
106
+ function backgroundResetAllFilter(attributes) {
107
+ const updatedClassName = attributes.className?.includes("has-background") ? attributes.className.split(" ").filter((c) => c !== "has-background").join(" ") || void 0 : attributes.className;
108
+ return {
109
+ ...attributes,
110
+ className: updatedClassName,
111
+ backgroundColor: void 0,
112
+ gradient: void 0,
113
+ style: (0, import_utils.cleanEmptyObject)({
114
+ ...attributes.style,
115
+ background: void 0,
116
+ color: {
117
+ ...attributes.style?.color,
118
+ background: void 0,
119
+ gradient: void 0
120
+ }
121
+ })
122
+ };
123
+ }
124
+ function BackgroundInspectorControl({ children }) {
125
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
126
+ import_inspector_controls.default,
127
+ {
128
+ group: "background",
129
+ resetAllFilter: backgroundResetAllFilter,
130
+ children
131
+ }
126
132
  );
127
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_inspector_controls.default, { group: "background", resetAllFilter, children });
128
133
  }
129
134
  function BackgroundImagePanel({
130
135
  clientId,
131
136
  name,
132
137
  setAttributes,
133
- settings
138
+ settings,
139
+ // Allows rendering outside the `background` inspector group (e.g. section
140
+ // blocks direct-render this panel because their support fills are gated
141
+ // off by editing mode). Defaults to the slot-based wrapper.
142
+ asWrapper
134
143
  }) {
135
144
  const selectedState = (0, import_block_style_state.useBlockStyleState)();
136
- const { style, className, inheritedValue } = (0, import_data.useSelect)(
145
+ const { style, className, backgroundColor, gradient, inheritedValue } = (0, import_data.useSelect)(
137
146
  (select) => {
138
147
  const { getBlockAttributes, getSettings } = select(import_store.store);
139
148
  const _settings = getSettings();
@@ -141,13 +150,8 @@ function BackgroundImagePanel({
141
150
  return {
142
151
  style: blockAttributes?.style,
143
152
  className: blockAttributes?.className,
144
- /*
145
- * To ensure we pass down the right inherited values:
146
- * @TODO 1. Pass inherited value down to all block style controls,
147
- * See: packages/block-editor/src/hooks/style.js
148
- * @TODO 2. Add support for block style variations,
149
- * See implementation: packages/block-editor/src/hooks/block-style-variation.js
150
- */
153
+ backgroundColor: blockAttributes?.backgroundColor,
154
+ gradient: blockAttributes?.gradient,
151
155
  inheritedValue: _settings[import_private_keys.globalStylesDataKey]?.blocks?.[name]
152
156
  };
153
157
  },
@@ -157,54 +161,85 @@ function BackgroundImagePanel({
157
161
  name,
158
162
  "gradient"
159
163
  );
160
- const as = (0, import_element.useCallback)(
161
- ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
162
- BackgroundInspectorControl,
163
- {
164
- backgroundGradientSupported,
165
- children
164
+ const colorSupport = (0, import_blocks.getBlockSupport)(name, "color");
165
+ const hasColorBackgroundSupport = colorSupport && colorSupport.background !== false;
166
+ const hasColorGradientSupport = !!colorSupport?.gradients;
167
+ const isStateSelected = !(0, import_block_style_state.isDefaultBlockStyleState)(selectedState);
168
+ const styleValue = {
169
+ ...style,
170
+ color: {
171
+ ...style?.color,
172
+ background: backgroundColor ? "var:preset|color|" + backgroundColor : style?.color?.background,
173
+ gradient: !backgroundGradientSupported && gradient ? "var:preset|gradient|" + gradient : style?.color?.gradient
174
+ },
175
+ ...backgroundGradientSupported && {
176
+ background: {
177
+ ...style?.background,
178
+ gradient: gradient ? "var:preset|gradient|" + gradient : style?.background?.gradient ?? style?.color?.gradient
166
179
  }
167
- ),
168
- [backgroundGradientSupported]
169
- );
170
- if (!(0, import_background_panel.useHasBackgroundPanel)(settings) || !hasBackgroundSupport(name)) {
180
+ }
181
+ };
182
+ const enableContrastChecking = !isStateSelected && !styleValue?.color?.gradient && !styleValue?.background?.gradient && !!styleValue?.color?.background && (settings?.color?.text || settings?.color?.link) && false !== (0, import_blocks.getBlockSupport)(name, ["color", "enableContrastChecker"]);
183
+ const contrastWarning = (0, import_contrast_checker.default)({
184
+ clientId,
185
+ name,
186
+ enabled: !!enableContrastChecking,
187
+ messageOverride: (0, import_i18n.__)(
188
+ "This color combination has poor contrast. Consider increasing contrast between background and foreground."
189
+ )
190
+ });
191
+ if (!(0, import_background_panel.useHasBackgroundPanel)(settings) || !hasBackgroundSupport(name) && !hasColorBackgroundSupport && !hasColorGradientSupport) {
171
192
  return null;
172
193
  }
173
- const isStateSelected = !(0, import_block_style_state.isDefaultBlockStyleState)(selectedState);
174
- const onChange = isStateSelected ? (newStyle) => {
175
- setAttributes({
176
- style: (0, import_block_style_state.setStyleForState)(style, selectedState, newStyle)
177
- });
178
- } : (newStyle) => {
194
+ const onChange = (newStyle) => {
195
+ if (isStateSelected) {
196
+ setAttributes({
197
+ style: (0, import_block_style_state.setStyleForState)(style, selectedState, newStyle)
198
+ });
199
+ return;
200
+ }
201
+ const newBackgroundColorValue = newStyle?.color?.background;
202
+ const newBackgroundColorSlug = (0, import_color_values.extractPresetSlug)(
203
+ newBackgroundColorValue,
204
+ "color"
205
+ );
206
+ const newGradientValue = backgroundGradientSupported ? newStyle?.background?.gradient : newStyle?.color?.gradient;
207
+ const newGradientSlug = (0, import_color_values.extractPresetSlug)(
208
+ newGradientValue,
209
+ "gradient"
210
+ );
211
+ const cleanedColorGradient = newGradientSlug ? void 0 : newStyle?.color?.gradient;
212
+ const cleanedStyle = {
213
+ ...newStyle,
214
+ color: {
215
+ ...newStyle?.color,
216
+ background: newBackgroundColorSlug ? void 0 : newBackgroundColorValue,
217
+ gradient: backgroundGradientSupported ? void 0 : cleanedColorGradient
218
+ }
219
+ };
220
+ if (backgroundGradientSupported) {
221
+ cleanedStyle.background = {
222
+ ...cleanedStyle.background,
223
+ gradient: newStyle?.background?.gradient
224
+ };
225
+ }
179
226
  const isMigrating = backgroundGradientSupported && !!style?.color?.gradient;
180
227
  const newAttributes = {
181
- style: (0, import_utils.cleanEmptyObject)(
182
- backgroundGradientSupported ? {
183
- ...newStyle,
184
- color: {
185
- ...newStyle?.color,
186
- gradient: void 0
187
- }
188
- } : newStyle
189
- )
228
+ style: (0, import_utils.cleanEmptyObject)(cleanedStyle),
229
+ backgroundColor: newBackgroundColorSlug,
230
+ // The legacy `gradient` attribute is only used when the block does
231
+ // not support `background.gradient`; otherwise the gradient is
232
+ // stored in `style.background.gradient` above.
233
+ gradient: backgroundGradientSupported ? void 0 : newGradientSlug
190
234
  };
191
- if (isMigrating && !!newStyle?.background?.gradient) {
192
- newAttributes.className = (0, import_clsx.default)(
193
- className,
194
- "has-background"
195
- );
196
- } else if (!newStyle?.background?.gradient && className?.includes("has-background")) {
235
+ const hasNewGradient = !!newGradientSlug || !!newGradientValue;
236
+ if (isMigrating && hasNewGradient) {
237
+ newAttributes.className = (0, import_clsx.default)(className, "has-background");
238
+ } else if (!hasNewGradient && className?.includes("has-background")) {
197
239
  newAttributes.className = className.split(" ").filter((c) => c !== "has-background").join(" ") || void 0;
198
240
  }
199
241
  setAttributes(newAttributes);
200
242
  };
201
- const styleValue = backgroundGradientSupported && !style?.background?.gradient && style?.color?.gradient ? {
202
- ...style,
203
- background: {
204
- ...style?.background,
205
- gradient: style?.color?.gradient
206
- }
207
- } : style;
208
243
  const updatedSettings = {
209
244
  ...settings,
210
245
  background: {
@@ -212,21 +247,34 @@ function BackgroundImagePanel({
212
247
  backgroundSize: settings?.background?.backgroundSize && hasBackgroundSupport(name, "backgroundSize")
213
248
  }
214
249
  };
215
- const defaultControls = (0, import_blocks.getBlockSupport)(name, [
250
+ const backgroundDefaultControls = (0, import_blocks.getBlockSupport)(name, [
216
251
  BACKGROUND_SUPPORT_KEY,
217
252
  "__experimentalDefaultControls"
218
253
  ]);
254
+ const colorDefaultControls = (0, import_blocks.getBlockSupport)(name, [
255
+ "color",
256
+ "__experimentalDefaultControls"
257
+ ]);
258
+ const defaultControls = {
259
+ ...backgroundDefaultControls,
260
+ backgroundColor: colorDefaultControls?.background,
261
+ // Mirror the old combined control: show the gradient item by default
262
+ // when background color was shown by default.
263
+ gradient: backgroundDefaultControls?.gradient ?? colorDefaultControls?.background
264
+ };
265
+ const Wrapper = asWrapper || BackgroundInspectorControl;
219
266
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
220
267
  import_background_panel.default,
221
268
  {
222
269
  inheritedValue,
223
- as,
270
+ as: Wrapper,
224
271
  panelId: clientId,
225
272
  defaultValues: BACKGROUND_BLOCK_DEFAULT_VALUES,
226
273
  settings: updatedSettings,
227
274
  onChange,
228
275
  defaultControls,
229
- value: isStateSelected ? (0, import_block_style_state.getStyleForState)(style, selectedState) : styleValue
276
+ value: isStateSelected ? (0, import_block_style_state.getStyleForState)(style, selectedState) : styleValue,
277
+ contrastWarning
230
278
  }
231
279
  );
232
280
  }
@@ -240,6 +288,7 @@ var background_default = {
240
288
  BACKGROUND_BLOCK_DEFAULT_VALUES,
241
289
  BACKGROUND_SUPPORT_KEY,
242
290
  BackgroundImagePanel,
291
+ backgroundResetAllFilter,
243
292
  getBackgroundImageClasses,
244
293
  hasBackgroundSupport,
245
294
  setBackgroundStyleDefaults
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/hooks/background.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport { cleanEmptyObject } from './utils';\nimport { store as blockEditorStore } from '../store';\nimport {\n\tdefault as StylesBackgroundPanel,\n\tuseHasBackgroundPanel,\n\thasBackgroundImageValue,\n\thasBackgroundGradientValue,\n} from '../components/global-styles/background-panel';\nimport { globalStylesDataKey } from '../store/private-keys';\nimport {\n\tgetStyleForState,\n\tisDefaultBlockStyleState,\n\tsetStyleForState,\n\tuseBlockStyleState,\n} from './block-style-state';\n\nexport const BACKGROUND_SUPPORT_KEY = 'background';\n\n// Initial control values.\nexport const BACKGROUND_BLOCK_DEFAULT_VALUES = {\n\tbackgroundSize: 'cover',\n\tbackgroundPosition: '50% 50%', // used only when backgroundSize is 'contain'.\n};\n\n/**\n * Determine whether there is block support for background.\n *\n * @param {string} blockName Block name.\n * @param {string} feature Background image feature to check for.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasBackgroundSupport( blockName, feature = 'any' ) {\n\tconst support = getBlockSupport( blockName, BACKGROUND_SUPPORT_KEY );\n\n\tif ( support === true ) {\n\t\treturn true;\n\t}\n\n\tif ( feature === 'any' ) {\n\t\treturn (\n\t\t\t!! support?.backgroundImage ||\n\t\t\t!! support?.backgroundSize ||\n\t\t\t!! support?.backgroundRepeat ||\n\t\t\t!! support?.gradient\n\t\t);\n\t}\n\n\treturn !! support?.[ feature ];\n}\n\nexport function setBackgroundStyleDefaults( backgroundStyle ) {\n\tif ( ! backgroundStyle || ! backgroundStyle?.backgroundImage?.url ) {\n\t\treturn;\n\t}\n\n\tlet backgroundStylesWithDefaults;\n\n\t// Set block background defaults.\n\tif ( ! backgroundStyle?.backgroundSize ) {\n\t\tbackgroundStylesWithDefaults = {\n\t\t\tbackgroundSize: BACKGROUND_BLOCK_DEFAULT_VALUES.backgroundSize,\n\t\t};\n\t}\n\n\tif (\n\t\t'contain' === backgroundStyle?.backgroundSize &&\n\t\t! backgroundStyle?.backgroundPosition\n\t) {\n\t\tbackgroundStylesWithDefaults = {\n\t\t\tbackgroundPosition:\n\t\t\t\tBACKGROUND_BLOCK_DEFAULT_VALUES.backgroundPosition,\n\t\t};\n\t}\n\treturn backgroundStylesWithDefaults;\n}\n\nfunction useBlockProps( { name, style } ) {\n\tif (\n\t\t! hasBackgroundSupport( name ) ||\n\t\t! style?.background?.backgroundImage\n\t) {\n\t\treturn;\n\t}\n\n\tconst backgroundStyles = setBackgroundStyleDefaults( style?.background );\n\n\tif ( ! backgroundStyles ) {\n\t\treturn;\n\t}\n\n\treturn {\n\t\tstyle: {\n\t\t\t...backgroundStyles,\n\t\t},\n\t};\n}\n\n/**\n * Generates a CSS class name if an background image is set.\n *\n * @param {Object} style A block's style attribute.\n *\n * @return {string} CSS class name.\n */\nexport function getBackgroundImageClasses( style ) {\n\treturn hasBackgroundImageValue( style ) ||\n\t\thasBackgroundGradientValue( style )\n\t\t? 'has-background'\n\t\t: '';\n}\n\nfunction BackgroundInspectorControl( {\n\tchildren,\n\tbackgroundGradientSupported = false,\n} ) {\n\tconst resetAllFilter = useCallback(\n\t\t( attributes ) => {\n\t\t\tconst updatedClassName = attributes.className?.includes(\n\t\t\t\t'has-background'\n\t\t\t)\n\t\t\t\t? attributes.className\n\t\t\t\t\t\t.split( ' ' )\n\t\t\t\t\t\t.filter( ( c ) => c !== 'has-background' )\n\t\t\t\t\t\t.join( ' ' ) || undefined\n\t\t\t\t: attributes.className;\n\t\t\treturn {\n\t\t\t\t...attributes,\n\t\t\t\tclassName: updatedClassName,\n\t\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t\t...attributes.style,\n\t\t\t\t\tbackground: undefined,\n\t\t\t\t\tcolor: backgroundGradientSupported\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t...attributes.style?.color,\n\t\t\t\t\t\t\t\tgradient: undefined,\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: attributes.style?.color,\n\t\t\t\t} ),\n\t\t\t};\n\t\t},\n\t\t[ backgroundGradientSupported ]\n\t);\n\treturn (\n\t\t<InspectorControls group=\"background\" resetAllFilter={ resetAllFilter }>\n\t\t\t{ children }\n\t\t</InspectorControls>\n\t);\n}\n\nexport function BackgroundImagePanel( {\n\tclientId,\n\tname,\n\tsetAttributes,\n\tsettings,\n} ) {\n\tconst selectedState = useBlockStyleState();\n\tconst { style, className, inheritedValue } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockAttributes, getSettings } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst _settings = getSettings();\n\t\t\tconst blockAttributes = getBlockAttributes( clientId );\n\t\t\treturn {\n\t\t\t\tstyle: blockAttributes?.style,\n\t\t\t\tclassName: blockAttributes?.className,\n\t\t\t\t/*\n\t\t\t\t * To ensure we pass down the right inherited values:\n\t\t\t\t * @TODO 1. Pass inherited value down to all block style controls,\n\t\t\t\t * See: packages/block-editor/src/hooks/style.js\n\t\t\t\t * @TODO 2. Add support for block style variations,\n\t\t\t\t * See implementation: packages/block-editor/src/hooks/block-style-variation.js\n\t\t\t\t */\n\t\t\t\tinheritedValue:\n\t\t\t\t\t_settings[ globalStylesDataKey ]?.blocks?.[ name ],\n\t\t\t};\n\t\t},\n\t\t[ clientId, name ]\n\t);\n\n\tconst backgroundGradientSupported = hasBackgroundSupport(\n\t\tname,\n\t\t'gradient'\n\t);\n\n\t// Must be declared before the early return to follow Rules of Hooks.\n\t// Passes backgroundGradientSupported so that \"Reset All\" also clears\n\t// the legacy color.gradient value when background.gradient is supported.\n\tconst as = useCallback(\n\t\t( { children } ) => (\n\t\t\t<BackgroundInspectorControl\n\t\t\t\tbackgroundGradientSupported={ backgroundGradientSupported }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</BackgroundInspectorControl>\n\t\t),\n\t\t[ backgroundGradientSupported ]\n\t);\n\n\tif (\n\t\t! useHasBackgroundPanel( settings ) ||\n\t\t! hasBackgroundSupport( name )\n\t) {\n\t\treturn null;\n\t}\n\n\tconst isStateSelected = ! isDefaultBlockStyleState( selectedState );\n\n\tconst onChange = isStateSelected\n\t\t? ( newStyle ) => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tstyle: setStyleForState( style, selectedState, newStyle ),\n\t\t\t\t} );\n\t\t }\n\t\t: ( newStyle ) => {\n\t\t\t\tconst isMigrating =\n\t\t\t\t\tbackgroundGradientSupported && !! style?.color?.gradient;\n\t\t\t\tconst newAttributes = {\n\t\t\t\t\tstyle: cleanEmptyObject(\n\t\t\t\t\t\tbackgroundGradientSupported\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t...newStyle,\n\t\t\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t\t\t...newStyle?.color,\n\t\t\t\t\t\t\t\t\t\tgradient: undefined,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: newStyle\n\t\t\t\t\t),\n\t\t\t\t};\n\n\t\t\t\t// When migrating from color.gradient to background.gradient, preserve\n\t\t\t\t// the has-background class so existing styles relying on it (e.g.\n\t\t\t\t// theme padding) are not silently broken. Only add the class when a\n\t\t\t\t// gradient value is being set — not when it is being cleared/reset.\n\t\t\t\t// Conversely, if the gradient is cleared and has-background was added\n\t\t\t\t// during a previous migration, remove it so it does not linger.\n\t\t\t\tif ( isMigrating && !! newStyle?.background?.gradient ) {\n\t\t\t\t\tnewAttributes.className = clsx(\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t'has-background'\n\t\t\t\t\t);\n\t\t\t\t} else if (\n\t\t\t\t\t! newStyle?.background?.gradient &&\n\t\t\t\t\tclassName?.includes( 'has-background' )\n\t\t\t\t) {\n\t\t\t\t\tnewAttributes.className =\n\t\t\t\t\t\tclassName\n\t\t\t\t\t\t\t.split( ' ' )\n\t\t\t\t\t\t\t.filter( ( c ) => c !== 'has-background' )\n\t\t\t\t\t\t\t.join( ' ' ) || undefined;\n\t\t\t\t}\n\n\t\t\t\tsetAttributes( newAttributes );\n\t\t };\n\n\t// When background.gradient is supported but not yet explicitly set, fall\n\t// back to color.gradient for display. Any write from this panel migrates\n\t// the value to background.gradient and clears color.gradient atomically.\n\tconst styleValue =\n\t\tbackgroundGradientSupported &&\n\t\t! style?.background?.gradient &&\n\t\tstyle?.color?.gradient\n\t\t\t? {\n\t\t\t\t\t...style,\n\t\t\t\t\tbackground: {\n\t\t\t\t\t\t...style?.background,\n\t\t\t\t\t\tgradient: style?.color?.gradient,\n\t\t\t\t\t},\n\t\t\t }\n\t\t\t: style;\n\n\tconst updatedSettings = {\n\t\t...settings,\n\t\tbackground: {\n\t\t\t...settings.background,\n\t\t\tbackgroundSize:\n\t\t\t\tsettings?.background?.backgroundSize &&\n\t\t\t\thasBackgroundSupport( name, 'backgroundSize' ),\n\t\t},\n\t};\n\n\tconst defaultControls = getBlockSupport( name, [\n\t\tBACKGROUND_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\treturn (\n\t\t<StylesBackgroundPanel\n\t\t\tinheritedValue={ inheritedValue }\n\t\t\tas={ as }\n\t\t\tpanelId={ clientId }\n\t\t\tdefaultValues={ BACKGROUND_BLOCK_DEFAULT_VALUES }\n\t\t\tsettings={ updatedSettings }\n\t\t\tonChange={ onChange }\n\t\t\tdefaultControls={ defaultControls }\n\t\t\tvalue={\n\t\t\t\tisStateSelected\n\t\t\t\t\t? getStyleForState( style, selectedState )\n\t\t\t\t\t: styleValue\n\t\t\t}\n\t\t/>\n\t);\n}\n\nexport default {\n\tuseBlockProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport: hasBackgroundSupport,\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,oBAAgC;AAChC,kBAA0B;AAC1B,qBAA4B;AAK5B,gCAA8B;AAC9B,mBAAiC;AACjC,mBAA0C;AAC1C,8BAKO;AACP,0BAAoC;AACpC,+BAKO;AAkIL;AAhIK,IAAM,yBAAyB;AAG/B,IAAM,kCAAkC;AAAA,EAC9C,gBAAgB;AAAA,EAChB,oBAAoB;AAAA;AACrB;AAUO,SAAS,qBAAsB,WAAW,UAAU,OAAQ;AAClE,QAAM,cAAU,+BAAiB,WAAW,sBAAuB;AAEnE,MAAK,YAAY,MAAO;AACvB,WAAO;AAAA,EACR;AAEA,MAAK,YAAY,OAAQ;AACxB,WACC,CAAC,CAAE,SAAS,mBACZ,CAAC,CAAE,SAAS,kBACZ,CAAC,CAAE,SAAS,oBACZ,CAAC,CAAE,SAAS;AAAA,EAEd;AAEA,SAAO,CAAC,CAAE,UAAW,OAAQ;AAC9B;AAEO,SAAS,2BAA4B,iBAAkB;AAC7D,MAAK,CAAE,mBAAmB,CAAE,iBAAiB,iBAAiB,KAAM;AACnE;AAAA,EACD;AAEA,MAAI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,CAAC,CAAE,UAAU,YAAY,UAAW;AACvD,oBAAc,gBAAY,YAAAC;AAAA,QACzB;AAAA,QACA;AAAA,MACD;AAAA,IACD,WACC,CAAE,UAAU,YAAY,YACxB,WAAW,SAAU,gBAAiB,GACrC;AACD,oBAAc,YACb,UACE,MAAO,GAAI,EACX,OAAQ,CAAE,MAAO,MAAM,gBAAiB,EACxC,KAAM,GAAI,KAAK;AAAA,IACnB;AAEA,kBAAe,aAAc;AAAA,EAC7B;AAKH,QAAM,aACL,+BACA,CAAE,OAAO,YAAY,YACrB,OAAO,OAAO,WACX;AAAA,IACA,GAAG;AAAA,IACH,YAAY;AAAA,MACX,GAAG,OAAO;AAAA,MACV,UAAU,OAAO,OAAO;AAAA,IACzB;AAAA,EACA,IACA;AAEJ,QAAM,kBAAkB;AAAA,IACvB,GAAG;AAAA,IACH,YAAY;AAAA,MACX,GAAG,SAAS;AAAA,MACZ,gBACC,UAAU,YAAY,kBACtB,qBAAsB,MAAM,gBAAiB;AAAA,IAC/C;AAAA,EACD;AAEA,QAAM,sBAAkB,+BAAiB,MAAM;AAAA,IAC9C;AAAA,IACA;AAAA,EACD,CAAE;AAEF,SACC;AAAA,IAAC,wBAAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAU;AAAA,MACV,eAAgB;AAAA,MAChB,UAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA,OACC,sBACG,2CAAkB,OAAO,aAAc,IACvC;AAAA;AAAA,EAEL;AAEF;AAEA,IAAO,qBAAQ;AAAA,EACd;AAAA,EACA,eAAe,CAAE,OAAQ;AAAA,EACzB,YAAY;AACb;",
6
- "names": ["InspectorControls", "blockEditorStore", "clsx", "StylesBackgroundPanel"]
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport { cleanEmptyObject } from './utils';\nimport { extractPresetSlug } from '../utils/color-values';\nimport { store as blockEditorStore } from '../store';\nimport useBlockColorContrastWarning from './contrast-checker';\nimport {\n\tdefault as StylesBackgroundPanel,\n\tuseHasBackgroundPanel,\n\thasBackgroundImageValue,\n\thasBackgroundGradientValue,\n} from '../components/global-styles/background-panel';\nimport { globalStylesDataKey } from '../store/private-keys';\nimport {\n\tgetStyleForState,\n\tisDefaultBlockStyleState,\n\tsetStyleForState,\n\tuseBlockStyleState,\n} from './block-style-state';\n\nexport const BACKGROUND_SUPPORT_KEY = 'background';\n\n// Initial control values.\nexport const BACKGROUND_BLOCK_DEFAULT_VALUES = {\n\tbackgroundSize: 'cover',\n\tbackgroundPosition: '50% 50%', // used only when backgroundSize is 'contain'.\n};\n\n/**\n * Determine whether there is block support for background.\n *\n * @param {string} blockName Block name.\n * @param {string} feature Background image feature to check for.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasBackgroundSupport( blockName, feature = 'any' ) {\n\tconst support = getBlockSupport( blockName, BACKGROUND_SUPPORT_KEY );\n\n\tif ( support === true ) {\n\t\treturn true;\n\t}\n\n\tif ( feature === 'any' ) {\n\t\treturn (\n\t\t\t!! support?.backgroundImage ||\n\t\t\t!! support?.backgroundSize ||\n\t\t\t!! support?.backgroundRepeat ||\n\t\t\t!! support?.gradient\n\t\t);\n\t}\n\n\treturn !! support?.[ feature ];\n}\n\nexport function setBackgroundStyleDefaults( backgroundStyle ) {\n\tif ( ! backgroundStyle || ! backgroundStyle?.backgroundImage?.url ) {\n\t\treturn;\n\t}\n\n\tlet backgroundStylesWithDefaults;\n\n\t// Set block background defaults.\n\tif ( ! backgroundStyle?.backgroundSize ) {\n\t\tbackgroundStylesWithDefaults = {\n\t\t\tbackgroundSize: BACKGROUND_BLOCK_DEFAULT_VALUES.backgroundSize,\n\t\t};\n\t}\n\n\tif (\n\t\t'contain' === backgroundStyle?.backgroundSize &&\n\t\t! backgroundStyle?.backgroundPosition\n\t) {\n\t\tbackgroundStylesWithDefaults = {\n\t\t\tbackgroundPosition:\n\t\t\t\tBACKGROUND_BLOCK_DEFAULT_VALUES.backgroundPosition,\n\t\t};\n\t}\n\treturn backgroundStylesWithDefaults;\n}\n\nfunction useBlockProps( { name, style } ) {\n\tif (\n\t\t! hasBackgroundSupport( name ) ||\n\t\t! style?.background?.backgroundImage\n\t) {\n\t\treturn;\n\t}\n\n\tconst backgroundStyles = setBackgroundStyleDefaults( style?.background );\n\n\tif ( ! backgroundStyles ) {\n\t\treturn;\n\t}\n\n\treturn {\n\t\tstyle: {\n\t\t\t...backgroundStyles,\n\t\t},\n\t};\n}\n\n/**\n * Generates a CSS class name if an background image is set.\n *\n * @param {Object} style A block's style attribute.\n *\n * @return {string} CSS class name.\n */\nexport function getBackgroundImageClasses( style ) {\n\treturn hasBackgroundImageValue( style ) ||\n\t\thasBackgroundGradientValue( style )\n\t\t? 'has-background'\n\t\t: '';\n}\n\n// Clears every control the Background panel owns: the background image,\n// background color, and the gradient. The Background panel owns the gradient\n// control for both the newer `background.gradient` support and the legacy\n// `color.gradient` path, so \"Reset all\" clears the legacy value too,\n// regardless of which path stored it.\nexport function backgroundResetAllFilter( attributes ) {\n\tconst updatedClassName = attributes.className?.includes( 'has-background' )\n\t\t? attributes.className\n\t\t\t\t.split( ' ' )\n\t\t\t\t.filter( ( c ) => c !== 'has-background' )\n\t\t\t\t.join( ' ' ) || undefined\n\t\t: attributes.className;\n\treturn {\n\t\t...attributes,\n\t\tclassName: updatedClassName,\n\t\tbackgroundColor: undefined,\n\t\tgradient: undefined,\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...attributes.style,\n\t\t\tbackground: undefined,\n\t\t\tcolor: {\n\t\t\t\t...attributes.style?.color,\n\t\t\t\tbackground: undefined,\n\t\t\t\tgradient: undefined,\n\t\t\t},\n\t\t} ),\n\t};\n}\n\nfunction BackgroundInspectorControl( { children } ) {\n\treturn (\n\t\t<InspectorControls\n\t\t\tgroup=\"background\"\n\t\t\tresetAllFilter={ backgroundResetAllFilter }\n\t\t>\n\t\t\t{ children }\n\t\t</InspectorControls>\n\t);\n}\n\nexport function BackgroundImagePanel( {\n\tclientId,\n\tname,\n\tsetAttributes,\n\tsettings,\n\t// Allows rendering outside the `background` inspector group (e.g. section\n\t// blocks direct-render this panel because their support fills are gated\n\t// off by editing mode). Defaults to the slot-based wrapper.\n\tasWrapper,\n} ) {\n\tconst selectedState = useBlockStyleState();\n\tconst { style, className, backgroundColor, gradient, inheritedValue } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { getBlockAttributes, getSettings } =\n\t\t\t\t\tselect( blockEditorStore );\n\t\t\t\tconst _settings = getSettings();\n\t\t\t\tconst blockAttributes = getBlockAttributes( clientId );\n\t\t\t\treturn {\n\t\t\t\t\tstyle: blockAttributes?.style,\n\t\t\t\t\tclassName: blockAttributes?.className,\n\t\t\t\t\tbackgroundColor: blockAttributes?.backgroundColor,\n\t\t\t\t\tgradient: blockAttributes?.gradient,\n\t\t\t\t\tinheritedValue:\n\t\t\t\t\t\t_settings[ globalStylesDataKey ]?.blocks?.[ name ],\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientId, name ]\n\t\t);\n\n\tconst backgroundGradientSupported = hasBackgroundSupport(\n\t\tname,\n\t\t'gradient'\n\t);\n\n\tconst colorSupport = getBlockSupport( name, 'color' );\n\tconst hasColorBackgroundSupport =\n\t\tcolorSupport && colorSupport.background !== false;\n\tconst hasColorGradientSupport = !! colorSupport?.gradients;\n\n\tconst isStateSelected = ! isDefaultBlockStyleState( selectedState );\n\n\t// Fold the backgroundColor / gradient attribute slugs back into the style\n\t// object the panel consumes. When background.gradient is supported but not\n\t// yet explicitly set, fall back to color.gradient for display.\n\tconst styleValue = {\n\t\t...style,\n\t\tcolor: {\n\t\t\t...style?.color,\n\t\t\tbackground: backgroundColor\n\t\t\t\t? 'var:preset|color|' + backgroundColor\n\t\t\t\t: style?.color?.background,\n\t\t\tgradient:\n\t\t\t\t! backgroundGradientSupported && gradient\n\t\t\t\t\t? 'var:preset|gradient|' + gradient\n\t\t\t\t\t: style?.color?.gradient,\n\t\t},\n\t\t...( backgroundGradientSupported && {\n\t\t\tbackground: {\n\t\t\t\t...style?.background,\n\t\t\t\tgradient: gradient\n\t\t\t\t\t? 'var:preset|gradient|' + gradient\n\t\t\t\t\t: style?.background?.gradient ?? style?.color?.gradient,\n\t\t\t},\n\t\t} ),\n\t};\n\n\t// Skipped for gradients, which can't be reliably evaluated for contrast.\n\tconst enableContrastChecking =\n\t\t! isStateSelected &&\n\t\t! styleValue?.color?.gradient &&\n\t\t! styleValue?.background?.gradient &&\n\t\t!! styleValue?.color?.background &&\n\t\t( settings?.color?.text || settings?.color?.link ) &&\n\t\tfalse !== getBlockSupport( name, [ 'color', 'enableContrastChecker' ] );\n\n\tconst contrastWarning = useBlockColorContrastWarning( {\n\t\tclientId,\n\t\tname,\n\t\tenabled: !! enableContrastChecking,\n\t\tmessageOverride: __(\n\t\t\t'This color combination has poor contrast. Consider increasing contrast between background and foreground.'\n\t\t),\n\t} );\n\n\tif (\n\t\t! useHasBackgroundPanel( settings ) ||\n\t\t( ! hasBackgroundSupport( name ) &&\n\t\t\t! hasColorBackgroundSupport &&\n\t\t\t! hasColorGradientSupport )\n\t) {\n\t\treturn null;\n\t}\n\n\tconst onChange = ( newStyle ) => {\n\t\tif ( isStateSelected ) {\n\t\t\tsetAttributes( {\n\t\t\t\tstyle: setStyleForState( style, selectedState, newStyle ),\n\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\t// Extract background color slug from style.color.background.\n\t\tconst newBackgroundColorValue = newStyle?.color?.background;\n\t\tconst newBackgroundColorSlug = extractPresetSlug(\n\t\t\tnewBackgroundColorValue,\n\t\t\t'color'\n\t\t);\n\n\t\t// Extract gradient slug — prefer the new background.gradient path\n\t\t// when backgroundGradientSupported, fall back to color.gradient.\n\t\tconst newGradientValue = backgroundGradientSupported\n\t\t\t? newStyle?.background?.gradient\n\t\t\t: newStyle?.color?.gradient;\n\t\tconst newGradientSlug = extractPresetSlug(\n\t\t\tnewGradientValue,\n\t\t\t'gradient'\n\t\t);\n\t\tconst cleanedColorGradient = newGradientSlug\n\t\t\t? undefined\n\t\t\t: newStyle?.color?.gradient;\n\n\t\t// Drop slug-resolved values so they aren't persisted inline alongside\n\t\t// the attribute slugs.\n\t\tconst cleanedStyle = {\n\t\t\t...newStyle,\n\t\t\tcolor: {\n\t\t\t\t...newStyle?.color,\n\t\t\t\tbackground: newBackgroundColorSlug\n\t\t\t\t\t? undefined\n\t\t\t\t\t: newBackgroundColorValue,\n\t\t\t\tgradient: backgroundGradientSupported\n\t\t\t\t\t? undefined\n\t\t\t\t\t: cleanedColorGradient,\n\t\t\t},\n\t\t};\n\t\tif ( backgroundGradientSupported ) {\n\t\t\t// Background gradients are kept whole in `style.background.gradient`\n\t\t\t// rather than extracted to the legacy `gradient` attribute.\n\t\t\tcleanedStyle.background = {\n\t\t\t\t...cleanedStyle.background,\n\t\t\t\tgradient: newStyle?.background?.gradient,\n\t\t\t};\n\t\t}\n\n\t\tconst isMigrating =\n\t\t\tbackgroundGradientSupported && !! style?.color?.gradient;\n\t\tconst newAttributes = {\n\t\t\tstyle: cleanEmptyObject( cleanedStyle ),\n\t\t\tbackgroundColor: newBackgroundColorSlug,\n\t\t\t// The legacy `gradient` attribute is only used when the block does\n\t\t\t// not support `background.gradient`; otherwise the gradient is\n\t\t\t// stored in `style.background.gradient` above.\n\t\t\tgradient: backgroundGradientSupported ? undefined : newGradientSlug,\n\t\t};\n\n\t\t// When migrating from color.gradient to background.gradient, preserve\n\t\t// the has-background class so existing styles relying on it (e.g.\n\t\t// theme padding) are not silently broken. Only add the class when a\n\t\t// gradient value is being set — not when it is being cleared/reset.\n\t\t// Conversely, if the gradient is cleared and has-background was added\n\t\t// during a previous migration, remove it so it does not linger.\n\t\tconst hasNewGradient = !! newGradientSlug || !! newGradientValue;\n\t\tif ( isMigrating && hasNewGradient ) {\n\t\t\tnewAttributes.className = clsx( className, 'has-background' );\n\t\t} else if (\n\t\t\t! hasNewGradient &&\n\t\t\tclassName?.includes( 'has-background' )\n\t\t) {\n\t\t\tnewAttributes.className =\n\t\t\t\tclassName\n\t\t\t\t\t.split( ' ' )\n\t\t\t\t\t.filter( ( c ) => c !== 'has-background' )\n\t\t\t\t\t.join( ' ' ) || undefined;\n\t\t}\n\n\t\tsetAttributes( newAttributes );\n\t};\n\n\tconst updatedSettings = {\n\t\t...settings,\n\t\tbackground: {\n\t\t\t...settings.background,\n\t\t\tbackgroundSize:\n\t\t\t\tsettings?.background?.backgroundSize &&\n\t\t\t\thasBackgroundSupport( name, 'backgroundSize' ),\n\t\t},\n\t};\n\n\tconst backgroundDefaultControls = getBlockSupport( name, [\n\t\tBACKGROUND_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\tconst colorDefaultControls = getBlockSupport( name, [\n\t\t'color',\n\t\t'__experimentalDefaultControls',\n\t] );\n\tconst defaultControls = {\n\t\t...backgroundDefaultControls,\n\t\tbackgroundColor: colorDefaultControls?.background,\n\t\t// Mirror the old combined control: show the gradient item by default\n\t\t// when background color was shown by default.\n\t\tgradient:\n\t\t\tbackgroundDefaultControls?.gradient ??\n\t\t\tcolorDefaultControls?.background,\n\t};\n\n\tconst Wrapper = asWrapper || BackgroundInspectorControl;\n\n\treturn (\n\t\t<StylesBackgroundPanel\n\t\t\tinheritedValue={ inheritedValue }\n\t\t\tas={ Wrapper }\n\t\t\tpanelId={ clientId }\n\t\t\tdefaultValues={ BACKGROUND_BLOCK_DEFAULT_VALUES }\n\t\t\tsettings={ updatedSettings }\n\t\t\tonChange={ onChange }\n\t\t\tdefaultControls={ defaultControls }\n\t\t\tvalue={\n\t\t\t\tisStateSelected\n\t\t\t\t\t? getStyleForState( style, selectedState )\n\t\t\t\t\t: styleValue\n\t\t\t}\n\t\t\tcontrastWarning={ contrastWarning }\n\t\t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AAkB;AAAA,IACvB,GAAG;AAAA,IACH,YAAY;AAAA,MACX,GAAG,SAAS;AAAA,MACZ,gBACC,UAAU,YAAY,kBACtB,qBAAsB,MAAM,gBAAiB;AAAA,IAC/C;AAAA,EACD;AAEA,QAAM,gCAA4B,+BAAiB,MAAM;AAAA,IACxD;AAAA,IACA;AAAA,EACD,CAAE;AACF,QAAM,2BAAuB,+BAAiB,MAAM;AAAA,IACnD;AAAA,IACA;AAAA,EACD,CAAE;AACF,QAAM,kBAAkB;AAAA,IACvB,GAAG;AAAA,IACH,iBAAiB,sBAAsB;AAAA;AAAA;AAAA,IAGvC,UACC,2BAA2B,YAC3B,sBAAsB;AAAA,EACxB;AAEA,QAAM,UAAU,aAAa;AAE7B,SACC;AAAA,IAAC,wBAAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA,IAAK;AAAA,MACL,SAAU;AAAA,MACV,eAAgB;AAAA,MAChB,UAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA,OACC,sBACG,2CAAkB,OAAO,aAAc,IACvC;AAAA,MAEJ;AAAA;AAAA,EACD;AAEF;AAEA,IAAO,qBAAQ;AAAA,EACd;AAAA,EACA,eAAe,CAAE,OAAQ;AAAA,EACzB,YAAY;AACb;",
6
+ "names": ["InspectorControls", "blockEditorStore", "useBlockColorContrastWarning", "clsx", "StylesBackgroundPanel"]
7
7
  }