@wordpress/block-editor 12.15.0 → 12.16.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 (500) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +9 -4
  3. package/build/components/block-canvas/index.js +22 -6
  4. package/build/components/block-canvas/index.js.map +1 -1
  5. package/build/components/block-card/index.js +1 -1
  6. package/build/components/block-card/index.js.map +1 -1
  7. package/build/components/block-controls/hook.js +3 -23
  8. package/build/components/block-controls/hook.js.map +1 -1
  9. package/build/components/block-edit/context.js +5 -1
  10. package/build/components/block-edit/context.js.map +1 -1
  11. package/build/components/block-edit/index.js +18 -9
  12. package/build/components/block-edit/index.js.map +1 -1
  13. package/build/components/block-info-slot-fill/index.js +3 -4
  14. package/build/components/block-info-slot-fill/index.js.map +1 -1
  15. package/build/components/block-list/block.js +28 -9
  16. package/build/components/block-list/block.js.map +1 -1
  17. package/build/components/block-list/block.native.js +14 -5
  18. package/build/components/block-list/block.native.js.map +1 -1
  19. package/build/components/block-list/use-block-props/index.js +61 -18
  20. package/build/components/block-list/use-block-props/index.js.map +1 -1
  21. package/build/components/block-list/use-block-props/use-focus-first-element.js +4 -29
  22. package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  23. package/build/components/block-list/use-block-props/use-is-hovered.js +4 -14
  24. package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
  25. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
  26. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  27. package/build/components/block-patterns-list/index.js +1 -1
  28. package/build/components/block-patterns-list/index.js.map +1 -1
  29. package/build/components/block-removal-warning-modal/index.js +2 -9
  30. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  31. package/build/components/block-rename/modal.js +3 -0
  32. package/build/components/block-rename/modal.js.map +1 -1
  33. package/build/components/block-settings/container.native.js +6 -4
  34. package/build/components/block-settings/container.native.js.map +1 -1
  35. package/build/components/block-styles/index.js +1 -1
  36. package/build/components/block-styles/index.js.map +1 -1
  37. package/build/components/block-styles/index.native.js +3 -2
  38. package/build/components/block-styles/index.native.js.map +1 -1
  39. package/build/components/block-toolbar/index.js +89 -27
  40. package/build/components/block-toolbar/index.js.map +1 -1
  41. package/build/components/block-tools/block-toolbar-breadcrumb.js +49 -0
  42. package/build/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
  43. package/build/components/block-tools/block-toolbar-popover.js +86 -0
  44. package/build/components/block-tools/block-toolbar-popover.js.map +1 -0
  45. package/build/components/block-tools/index.js +27 -24
  46. package/build/components/block-tools/index.js.map +1 -1
  47. package/build/components/block-types-list/index.native.js +4 -3
  48. package/build/components/block-types-list/index.native.js.map +1 -1
  49. package/build/components/block-variation-picker/index.native.js +2 -1
  50. package/build/components/block-variation-picker/index.native.js.map +1 -1
  51. package/build/components/colors-gradients/control.js +28 -17
  52. package/build/components/colors-gradients/control.js.map +1 -1
  53. package/build/components/duotone-control/index.js +1 -4
  54. package/build/components/duotone-control/index.js.map +1 -1
  55. package/build/components/global-styles/color-panel.js +22 -20
  56. package/build/components/global-styles/color-panel.js.map +1 -1
  57. package/build/components/global-styles/filters-panel.js +9 -3
  58. package/build/components/global-styles/filters-panel.js.map +1 -1
  59. package/build/components/global-styles/typography-panel.js +20 -31
  60. package/build/components/global-styles/typography-panel.js.map +1 -1
  61. package/build/components/image-link-destinations/index.native.js +118 -0
  62. package/build/components/image-link-destinations/index.native.js.map +1 -0
  63. package/build/components/index.native.js +8 -0
  64. package/build/components/index.native.js.map +1 -1
  65. package/build/components/inserter/media-tab/media-panel.js +2 -2
  66. package/build/components/inserter/media-tab/media-panel.js.map +1 -1
  67. package/build/components/inserter/menu.js +14 -7
  68. package/build/components/inserter/menu.js.map +1 -1
  69. package/build/components/inserter/preview-panel.js +2 -2
  70. package/build/components/inserter/preview-panel.js.map +1 -1
  71. package/build/components/inserter-button/index.native.js +98 -0
  72. package/build/components/inserter-button/index.native.js.map +1 -0
  73. package/build/components/inserter-button/sparkles.js +23 -0
  74. package/build/components/inserter-button/sparkles.js.map +1 -0
  75. package/build/components/inserter-draggable-blocks/index.js +8 -4
  76. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  77. package/build/components/inspector-controls/fill.js +3 -3
  78. package/build/components/inspector-controls/fill.js.map +1 -1
  79. package/build/components/inspector-controls/fill.native.js +3 -3
  80. package/build/components/inspector-controls/fill.native.js.map +1 -1
  81. package/build/components/navigable-toolbar/index.js +2 -2
  82. package/build/components/navigable-toolbar/index.js.map +1 -1
  83. package/build/components/preview-options/index.js +6 -62
  84. package/build/components/preview-options/index.js.map +1 -1
  85. package/build/components/rich-text/content.js +26 -23
  86. package/build/components/rich-text/content.js.map +1 -1
  87. package/build/components/rich-text/get-rich-text-values.js +2 -1
  88. package/build/components/rich-text/get-rich-text-values.js.map +1 -1
  89. package/build/components/rich-text/index.js +2 -30
  90. package/build/components/rich-text/index.js.map +1 -1
  91. package/build/components/rich-text/index.native.js +9 -16
  92. package/build/components/rich-text/index.native.js.map +1 -1
  93. package/build/components/rich-text/native/get-format-colors.native.js +22 -24
  94. package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
  95. package/build/components/rich-text/native/index.native.js +7 -34
  96. package/build/components/rich-text/native/index.native.js.map +1 -1
  97. package/build/components/rich-text/use-input-rules.js +5 -1
  98. package/build/components/rich-text/use-input-rules.js.map +1 -1
  99. package/build/components/rich-text/with-deprecations.js +50 -0
  100. package/build/components/rich-text/with-deprecations.js.map +1 -0
  101. package/build/components/use-block-drop-zone/index.js +70 -8
  102. package/build/components/use-block-drop-zone/index.js.map +1 -1
  103. package/build/components/use-on-block-drop/index.js +1 -1
  104. package/build/components/use-on-block-drop/index.js.map +1 -1
  105. package/build/components/use-resize-canvas/index.js +4 -1
  106. package/build/components/use-resize-canvas/index.js.map +1 -1
  107. package/build/components/use-settings/index.js +14 -0
  108. package/build/components/use-settings/index.js.map +1 -1
  109. package/build/hooks/align.js +20 -68
  110. package/build/hooks/align.js.map +1 -1
  111. package/build/hooks/align.native.js +11 -1
  112. package/build/hooks/align.native.js.map +1 -1
  113. package/build/hooks/anchor.js +13 -29
  114. package/build/hooks/anchor.js.map +1 -1
  115. package/build/hooks/background.js +28 -31
  116. package/build/hooks/background.js.map +1 -1
  117. package/build/hooks/block-hooks.js +24 -32
  118. package/build/hooks/block-hooks.js.map +1 -1
  119. package/build/hooks/block-renaming.js +18 -22
  120. package/build/hooks/block-renaming.js.map +1 -1
  121. package/build/hooks/border.js +58 -80
  122. package/build/hooks/border.js.map +1 -1
  123. package/build/hooks/color.js +76 -89
  124. package/build/hooks/color.js.map +1 -1
  125. package/build/hooks/content-lock-ui.js +29 -29
  126. package/build/hooks/content-lock-ui.js.map +1 -1
  127. package/build/hooks/custom-class-name.js +12 -29
  128. package/build/hooks/custom-class-name.js.map +1 -1
  129. package/build/hooks/custom-fields.js +24 -38
  130. package/build/hooks/custom-fields.js.map +1 -1
  131. package/build/hooks/dimensions.js +21 -17
  132. package/build/hooks/dimensions.js.map +1 -1
  133. package/build/hooks/duotone.js +31 -61
  134. package/build/hooks/duotone.js.map +1 -1
  135. package/build/hooks/font-family.js +16 -25
  136. package/build/hooks/font-family.js.map +1 -1
  137. package/build/hooks/font-size.js +51 -119
  138. package/build/hooks/font-size.js.map +1 -1
  139. package/build/hooks/index.js +25 -14
  140. package/build/hooks/index.js.map +1 -1
  141. package/build/hooks/index.native.js +10 -3
  142. package/build/hooks/index.native.js.map +1 -1
  143. package/build/hooks/layout-child.js +68 -0
  144. package/build/hooks/layout-child.js.map +1 -0
  145. package/build/hooks/layout.js +16 -101
  146. package/build/hooks/layout.js.map +1 -1
  147. package/build/hooks/padding.js +2 -2
  148. package/build/hooks/padding.js.map +1 -1
  149. package/build/hooks/position.js +40 -62
  150. package/build/hooks/position.js.map +1 -1
  151. package/build/hooks/style.js +51 -88
  152. package/build/hooks/style.js.map +1 -1
  153. package/build/hooks/typography.js +34 -14
  154. package/build/hooks/typography.js.map +1 -1
  155. package/build/hooks/utils.js +154 -7
  156. package/build/hooks/utils.js.map +1 -1
  157. package/build/private-apis.js +0 -2
  158. package/build/private-apis.js.map +1 -1
  159. package/build/store/private-actions.js +8 -0
  160. package/build/store/private-actions.js.map +1 -1
  161. package/build/store/private-selectors.js +34 -0
  162. package/build/store/private-selectors.js.map +1 -1
  163. package/build/store/reducer.js +8 -0
  164. package/build/store/reducer.js.map +1 -1
  165. package/build/store/selectors.js +10 -60
  166. package/build/store/selectors.js.map +1 -1
  167. package/build/store/utils.js +66 -0
  168. package/build/store/utils.js.map +1 -0
  169. package/build/utils/object.js +21 -61
  170. package/build/utils/object.js.map +1 -1
  171. package/build/utils/selection.js +9 -1
  172. package/build/utils/selection.js.map +1 -1
  173. package/build-module/components/block-canvas/index.js +23 -7
  174. package/build-module/components/block-canvas/index.js.map +1 -1
  175. package/build-module/components/block-card/index.js +1 -1
  176. package/build-module/components/block-card/index.js.map +1 -1
  177. package/build-module/components/block-controls/hook.js +4 -24
  178. package/build-module/components/block-controls/hook.js.map +1 -1
  179. package/build-module/components/block-edit/context.js +2 -0
  180. package/build-module/components/block-edit/context.js.map +1 -1
  181. package/build-module/components/block-edit/index.js +19 -10
  182. package/build-module/components/block-edit/index.js.map +1 -1
  183. package/build-module/components/block-info-slot-fill/index.js +3 -3
  184. package/build-module/components/block-info-slot-fill/index.js.map +1 -1
  185. package/build-module/components/block-list/block.js +29 -10
  186. package/build-module/components/block-list/block.js.map +1 -1
  187. package/build-module/components/block-list/block.native.js +14 -5
  188. package/build-module/components/block-list/block.native.js.map +1 -1
  189. package/build-module/components/block-list/use-block-props/index.js +62 -19
  190. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  191. package/build-module/components/block-list/use-block-props/use-focus-first-element.js +4 -29
  192. package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  193. package/build-module/components/block-list/use-block-props/use-is-hovered.js +4 -14
  194. package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
  195. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
  196. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  197. package/build-module/components/block-patterns-list/index.js +1 -1
  198. package/build-module/components/block-patterns-list/index.js.map +1 -1
  199. package/build-module/components/block-removal-warning-modal/index.js +3 -10
  200. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  201. package/build-module/components/block-rename/modal.js +3 -0
  202. package/build-module/components/block-rename/modal.js.map +1 -1
  203. package/build-module/components/block-settings/container.native.js +4 -2
  204. package/build-module/components/block-settings/container.native.js.map +1 -1
  205. package/build-module/components/block-styles/index.js +1 -1
  206. package/build-module/components/block-styles/index.js.map +1 -1
  207. package/build-module/components/block-styles/index.native.js +3 -2
  208. package/build-module/components/block-styles/index.native.js.map +1 -1
  209. package/build-module/components/block-toolbar/index.js +88 -25
  210. package/build-module/components/block-toolbar/index.js.map +1 -1
  211. package/build-module/components/block-tools/block-toolbar-breadcrumb.js +41 -0
  212. package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
  213. package/build-module/components/block-tools/block-toolbar-popover.js +76 -0
  214. package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -0
  215. package/build-module/components/block-tools/index.js +27 -24
  216. package/build-module/components/block-tools/index.js.map +1 -1
  217. package/build-module/components/block-types-list/index.native.js +2 -1
  218. package/build-module/components/block-types-list/index.native.js.map +1 -1
  219. package/build-module/components/block-variation-picker/index.native.js +2 -1
  220. package/build-module/components/block-variation-picker/index.native.js.map +1 -1
  221. package/build-module/components/colors-gradients/control.js +29 -18
  222. package/build-module/components/colors-gradients/control.js.map +1 -1
  223. package/build-module/components/duotone-control/index.js +1 -4
  224. package/build-module/components/duotone-control/index.js.map +1 -1
  225. package/build-module/components/global-styles/color-panel.js +23 -21
  226. package/build-module/components/global-styles/color-panel.js.map +1 -1
  227. package/build-module/components/global-styles/filters-panel.js +10 -4
  228. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  229. package/build-module/components/global-styles/typography-panel.js +20 -31
  230. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  231. package/build-module/components/image-link-destinations/index.native.js +109 -0
  232. package/build-module/components/image-link-destinations/index.native.js.map +1 -0
  233. package/build-module/components/index.native.js +1 -0
  234. package/build-module/components/index.native.js.map +1 -1
  235. package/build-module/components/inserter/media-tab/media-panel.js +1 -1
  236. package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
  237. package/build-module/components/inserter/menu.js +14 -7
  238. package/build-module/components/inserter/menu.js.map +1 -1
  239. package/build-module/components/inserter/preview-panel.js +2 -2
  240. package/build-module/components/inserter/preview-panel.js.map +1 -1
  241. package/build-module/components/inserter-button/index.native.js +89 -0
  242. package/build-module/components/inserter-button/index.native.js.map +1 -0
  243. package/build-module/components/inserter-button/sparkles.js +15 -0
  244. package/build-module/components/inserter-button/sparkles.js.map +1 -0
  245. package/build-module/components/inserter-draggable-blocks/index.js +9 -5
  246. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  247. package/build-module/components/inspector-controls/fill.js +3 -3
  248. package/build-module/components/inspector-controls/fill.js.map +1 -1
  249. package/build-module/components/inspector-controls/fill.native.js +3 -3
  250. package/build-module/components/inspector-controls/fill.native.js.map +1 -1
  251. package/build-module/components/navigable-toolbar/index.js +2 -2
  252. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  253. package/build-module/components/preview-options/index.js +6 -62
  254. package/build-module/components/preview-options/index.js.map +1 -1
  255. package/build-module/components/rich-text/content.js +25 -21
  256. package/build-module/components/rich-text/content.js.map +1 -1
  257. package/build-module/components/rich-text/get-rich-text-values.js +2 -1
  258. package/build-module/components/rich-text/get-rich-text-values.js.map +1 -1
  259. package/build-module/components/rich-text/index.js +4 -32
  260. package/build-module/components/rich-text/index.js.map +1 -1
  261. package/build-module/components/rich-text/index.native.js +10 -18
  262. package/build-module/components/rich-text/index.native.js.map +1 -1
  263. package/build-module/components/rich-text/native/get-format-colors.native.js +22 -24
  264. package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
  265. package/build-module/components/rich-text/native/index.native.js +7 -34
  266. package/build-module/components/rich-text/native/index.native.js.map +1 -1
  267. package/build-module/components/rich-text/use-input-rules.js +5 -1
  268. package/build-module/components/rich-text/use-input-rules.js.map +1 -1
  269. package/build-module/components/rich-text/with-deprecations.js +42 -0
  270. package/build-module/components/rich-text/with-deprecations.js.map +1 -0
  271. package/build-module/components/use-block-drop-zone/index.js +69 -8
  272. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  273. package/build-module/components/use-on-block-drop/index.js +1 -1
  274. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  275. package/build-module/components/use-resize-canvas/index.js +4 -1
  276. package/build-module/components/use-resize-canvas/index.js.map +1 -1
  277. package/build-module/components/use-settings/index.js +13 -1
  278. package/build-module/components/use-settings/index.js.map +1 -1
  279. package/build-module/hooks/align.js +19 -66
  280. package/build-module/hooks/align.js.map +1 -1
  281. package/build-module/hooks/align.native.js +1 -0
  282. package/build-module/hooks/align.native.js.map +1 -1
  283. package/build-module/hooks/anchor.js +11 -26
  284. package/build-module/hooks/anchor.js.map +1 -1
  285. package/build-module/hooks/background.js +26 -28
  286. package/build-module/hooks/background.js.map +1 -1
  287. package/build-module/hooks/block-hooks.js +22 -30
  288. package/build-module/hooks/block-hooks.js.map +1 -1
  289. package/build-module/hooks/block-renaming.js +17 -21
  290. package/build-module/hooks/block-renaming.js.map +1 -1
  291. package/build-module/hooks/border.js +57 -78
  292. package/build-module/hooks/border.js.map +1 -1
  293. package/build-module/hooks/color.js +74 -86
  294. package/build-module/hooks/color.js.map +1 -1
  295. package/build-module/hooks/content-lock-ui.js +27 -27
  296. package/build-module/hooks/content-lock-ui.js.map +1 -1
  297. package/build-module/hooks/custom-class-name.js +11 -27
  298. package/build-module/hooks/custom-class-name.js.map +1 -1
  299. package/build-module/hooks/custom-fields.js +20 -39
  300. package/build-module/hooks/custom-fields.js.map +1 -1
  301. package/build-module/hooks/dimensions.js +21 -16
  302. package/build-module/hooks/dimensions.js.map +1 -1
  303. package/build-module/hooks/duotone.js +30 -61
  304. package/build-module/hooks/duotone.js.map +1 -1
  305. package/build-module/hooks/font-family.js +14 -23
  306. package/build-module/hooks/font-family.js.map +1 -1
  307. package/build-module/hooks/font-size.js +49 -119
  308. package/build-module/hooks/font-size.js.map +1 -1
  309. package/build-module/hooks/index.js +18 -14
  310. package/build-module/hooks/index.js.map +1 -1
  311. package/build-module/hooks/index.native.js +5 -3
  312. package/build-module/hooks/index.native.js.map +1 -1
  313. package/build-module/hooks/layout-child.js +60 -0
  314. package/build-module/hooks/layout-child.js.map +1 -0
  315. package/build-module/hooks/layout.js +13 -98
  316. package/build-module/hooks/layout.js.map +1 -1
  317. package/build-module/hooks/padding.js +2 -2
  318. package/build-module/hooks/padding.js.map +1 -1
  319. package/build-module/hooks/position.js +38 -59
  320. package/build-module/hooks/position.js.map +1 -1
  321. package/build-module/hooks/style.js +51 -84
  322. package/build-module/hooks/style.js.map +1 -1
  323. package/build-module/hooks/typography.js +33 -12
  324. package/build-module/hooks/typography.js.map +1 -1
  325. package/build-module/hooks/utils.js +149 -6
  326. package/build-module/hooks/utils.js.map +1 -1
  327. package/build-module/private-apis.js +0 -2
  328. package/build-module/private-apis.js.map +1 -1
  329. package/build-module/store/private-actions.js +7 -0
  330. package/build-module/store/private-actions.js.map +1 -1
  331. package/build-module/store/private-selectors.js +33 -1
  332. package/build-module/store/private-selectors.js.map +1 -1
  333. package/build-module/store/reducer.js +8 -0
  334. package/build-module/store/reducer.js.map +1 -1
  335. package/build-module/store/selectors.js +3 -53
  336. package/build-module/store/selectors.js.map +1 -1
  337. package/build-module/store/utils.js +56 -0
  338. package/build-module/store/utils.js.map +1 -0
  339. package/build-module/utils/object.js +21 -60
  340. package/build-module/utils/object.js.map +1 -1
  341. package/build-module/utils/selection.js +9 -1
  342. package/build-module/utils/selection.js.map +1 -1
  343. package/build-style/style-rtl.css +113 -293
  344. package/build-style/style.css +113 -293
  345. package/package.json +31 -31
  346. package/src/components/block-canvas/index.js +31 -17
  347. package/src/components/block-caption/README.md +2 -2
  348. package/src/components/block-card/index.js +5 -3
  349. package/src/components/block-card/style.scss +7 -3
  350. package/src/components/block-controls/hook.js +8 -30
  351. package/src/components/block-controls/test/index.js +3 -3
  352. package/src/components/block-edit/context.js +3 -0
  353. package/src/components/block-edit/index.js +36 -10
  354. package/src/components/block-info-slot-fill/index.js +6 -3
  355. package/src/components/block-inspector/style.scss +0 -4
  356. package/src/components/block-list/block.js +39 -5
  357. package/src/components/block-list/block.native.js +18 -4
  358. package/src/components/block-list/use-block-props/index.js +74 -21
  359. package/src/components/block-list/use-block-props/use-focus-first-element.js +1 -34
  360. package/src/components/block-list/use-block-props/use-is-hovered.js +2 -13
  361. package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +1 -5
  362. package/src/components/block-patterns-list/index.js +1 -1
  363. package/src/components/block-removal-warning-modal/index.js +7 -14
  364. package/src/components/block-rename/modal.js +7 -1
  365. package/src/components/block-settings/container.native.js +3 -5
  366. package/src/components/block-styles/index.js +1 -1
  367. package/src/components/block-styles/index.native.js +4 -2
  368. package/src/components/block-styles/style.scss +0 -11
  369. package/src/components/block-switcher/test/__snapshots__/index.js.snap +3 -1
  370. package/src/components/block-toolbar/index.js +180 -95
  371. package/src/components/block-toolbar/style.scss +50 -66
  372. package/src/components/block-tools/block-toolbar-breadcrumb.js +46 -0
  373. package/src/components/block-tools/block-toolbar-popover.js +90 -0
  374. package/src/components/block-tools/index.js +42 -29
  375. package/src/components/block-tools/style.scss +60 -172
  376. package/src/components/block-types-list/index.native.js +2 -1
  377. package/src/components/block-variation-picker/index.native.js +1 -1
  378. package/src/components/colors-gradients/control.js +49 -30
  379. package/src/components/colors-gradients/style.scss +0 -7
  380. package/src/components/duotone-control/index.js +2 -5
  381. package/src/components/duotone-control/style.scss +1 -6
  382. package/src/components/global-styles/color-panel.js +34 -25
  383. package/src/components/global-styles/filters-panel.js +8 -4
  384. package/src/components/global-styles/typography-panel.js +23 -43
  385. package/src/components/image-link-destinations/index.native.js +152 -0
  386. package/src/components/image-link-destinations/style.native.scss +16 -0
  387. package/src/components/index.native.js +1 -0
  388. package/src/components/inner-blocks/README.md +13 -2
  389. package/src/components/inserter/media-tab/media-panel.js +1 -1
  390. package/src/components/inserter/menu.js +16 -8
  391. package/src/components/inserter/preview-panel.js +2 -2
  392. package/src/components/inserter/style.scss +15 -17
  393. package/src/components/inserter-button/README.md +62 -0
  394. package/src/components/inserter-button/index.native.js +116 -0
  395. package/src/components/inserter-button/sparkles.js +15 -0
  396. package/src/components/inserter-button/style.native.scss +72 -0
  397. package/src/components/inserter-draggable-blocks/index.js +18 -5
  398. package/src/components/inspector-controls/fill.js +6 -3
  399. package/src/components/inspector-controls/fill.native.js +6 -3
  400. package/src/components/link-control/style.scss +1 -1
  401. package/src/components/link-control/test/index.js +1 -1
  402. package/src/components/navigable-toolbar/README.md +2 -0
  403. package/src/components/navigable-toolbar/index.js +2 -2
  404. package/src/components/preview-options/index.js +6 -86
  405. package/src/components/rich-text/content.js +27 -20
  406. package/src/components/rich-text/get-rich-text-values.js +6 -1
  407. package/src/components/rich-text/index.js +5 -46
  408. package/src/components/rich-text/index.native.js +8 -25
  409. package/src/components/rich-text/native/get-format-colors.native.js +33 -40
  410. package/src/components/rich-text/native/index.native.js +7 -48
  411. package/src/components/rich-text/use-input-rules.js +6 -1
  412. package/src/components/rich-text/with-deprecations.js +51 -0
  413. package/src/components/use-block-drop-zone/index.js +114 -14
  414. package/src/components/use-on-block-drop/index.js +2 -1
  415. package/src/components/use-resize-canvas/README.md +3 -3
  416. package/src/components/use-resize-canvas/index.js +4 -1
  417. package/src/components/use-settings/index.js +15 -1
  418. package/src/hooks/align.js +15 -76
  419. package/src/hooks/align.native.js +1 -0
  420. package/src/hooks/anchor.js +13 -33
  421. package/src/hooks/background.js +28 -23
  422. package/src/hooks/block-hooks.js +22 -51
  423. package/src/hooks/block-renaming.js +23 -37
  424. package/src/hooks/border.js +67 -118
  425. package/src/hooks/color.js +100 -132
  426. package/src/hooks/content-lock-ui.js +110 -122
  427. package/src/hooks/custom-class-name.js +8 -40
  428. package/src/hooks/custom-fields.js +20 -47
  429. package/src/hooks/dimensions.js +20 -16
  430. package/src/hooks/duotone.js +70 -127
  431. package/src/hooks/font-family.js +10 -29
  432. package/src/hooks/font-size.js +66 -162
  433. package/src/hooks/index.js +42 -14
  434. package/src/hooks/index.native.js +6 -3
  435. package/src/hooks/layout-child.js +53 -0
  436. package/src/hooks/layout.js +13 -102
  437. package/src/hooks/padding.js +2 -2
  438. package/src/hooks/position.js +50 -90
  439. package/src/hooks/style.js +117 -187
  440. package/src/hooks/test/align.js +1 -178
  441. package/src/hooks/typography.js +20 -16
  442. package/src/hooks/utils.js +187 -6
  443. package/src/private-apis.js +0 -2
  444. package/src/store/private-actions.js +8 -0
  445. package/src/store/private-selectors.js +45 -0
  446. package/src/store/reducer.js +8 -0
  447. package/src/store/selectors.js +5 -69
  448. package/src/store/utils.js +74 -0
  449. package/src/style.scss +0 -2
  450. package/src/utils/object.js +18 -69
  451. package/src/utils/selection.js +9 -2
  452. package/build/components/block-list/use-block-props/use-block-class-names.js +0 -67
  453. package/build/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
  454. package/build/components/block-list/use-block-props/use-block-custom-class-name.js +0 -46
  455. package/build/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
  456. package/build/components/block-list/use-block-props/use-block-default-class-name.js +0 -37
  457. package/build/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
  458. package/build/components/block-tools/back-compat.js +0 -45
  459. package/build/components/block-tools/back-compat.js.map +0 -1
  460. package/build/components/block-tools/block-contextual-toolbar.js +0 -91
  461. package/build/components/block-tools/block-contextual-toolbar.js.map +0 -1
  462. package/build/components/block-tools/selected-block-tools.js +0 -113
  463. package/build/components/block-tools/selected-block-tools.js.map +0 -1
  464. package/build/components/inserter/hooks/use-debounced-input.js +0 -22
  465. package/build/components/inserter/hooks/use-debounced-input.js.map +0 -1
  466. package/build/components/use-display-block-controls/index.js +0 -39
  467. package/build/components/use-display-block-controls/index.js.map +0 -1
  468. package/build/components/use-display-block-controls/index.native.js +0 -39
  469. package/build/components/use-display-block-controls/index.native.js.map +0 -1
  470. package/build-module/components/block-list/use-block-props/use-block-class-names.js +0 -60
  471. package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
  472. package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js +0 -40
  473. package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
  474. package/build-module/components/block-list/use-block-props/use-block-default-class-name.js +0 -31
  475. package/build-module/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
  476. package/build-module/components/block-tools/back-compat.js +0 -35
  477. package/build-module/components/block-tools/back-compat.js.map +0 -1
  478. package/build-module/components/block-tools/block-contextual-toolbar.js +0 -83
  479. package/build-module/components/block-tools/block-contextual-toolbar.js.map +0 -1
  480. package/build-module/components/block-tools/selected-block-tools.js +0 -105
  481. package/build-module/components/block-tools/selected-block-tools.js.map +0 -1
  482. package/build-module/components/inserter/hooks/use-debounced-input.js +0 -15
  483. package/build-module/components/inserter/hooks/use-debounced-input.js.map +0 -1
  484. package/build-module/components/use-display-block-controls/index.js +0 -32
  485. package/build-module/components/use-display-block-controls/index.js.map +0 -1
  486. package/build-module/components/use-display-block-controls/index.native.js +0 -32
  487. package/build-module/components/use-display-block-controls/index.native.js.map +0 -1
  488. package/src/components/block-list/use-block-props/use-block-class-names.js +0 -66
  489. package/src/components/block-list/use-block-props/use-block-custom-class-name.js +0 -44
  490. package/src/components/block-list/use-block-props/use-block-default-class-name.js +0 -35
  491. package/src/components/block-parent-selector/style.scss +0 -11
  492. package/src/components/block-tools/back-compat.js +0 -35
  493. package/src/components/block-tools/block-contextual-toolbar.js +0 -100
  494. package/src/components/block-tools/selected-block-tools.js +0 -127
  495. package/src/components/inserter/hooks/use-debounced-input.js +0 -18
  496. package/src/components/preview-options/README.md +0 -94
  497. package/src/components/preview-options/style.scss +0 -64
  498. package/src/components/use-display-block-controls/index.js +0 -36
  499. package/src/components/use-display-block-controls/index.native.js +0 -37
  500. package/src/hooks/test/color.js +0 -112
@@ -8,9 +8,10 @@ import classnames from 'classnames';
8
8
  */
9
9
  import { getBlockSupport } from '@wordpress/blocks';
10
10
  import { __experimentalHasSplitBorders as hasSplitBorders } from '@wordpress/components';
11
- import { createHigherOrderComponent } from '@wordpress/compose';
11
+ import { pure } from '@wordpress/compose';
12
12
  import { Platform, useCallback, useMemo } from '@wordpress/element';
13
13
  import { addFilter } from '@wordpress/hooks';
14
+ import { useSelect } from '@wordpress/data';
14
15
 
15
16
  /**
16
17
  * Internal dependencies
@@ -18,15 +19,12 @@ import { addFilter } from '@wordpress/hooks';
18
19
  import { getColorClassName } from '../components/colors';
19
20
  import InspectorControls from '../components/inspector-controls';
20
21
  import useMultipleOriginColorsAndGradients from '../components/colors-gradients/use-multiple-origin-colors-and-gradients';
21
- import {
22
- cleanEmptyObject,
23
- shouldSkipSerialization,
24
- useBlockSettings,
25
- } from './utils';
22
+ import { cleanEmptyObject, shouldSkipSerialization } from './utils';
26
23
  import {
27
24
  useHasBorderPanel,
28
25
  BorderPanel as StylesBorderPanel,
29
26
  } from '../components/global-styles';
27
+ import { store as blockEditorStore } from '../store';
30
28
 
31
29
  export const BORDER_SUPPORT_KEY = '__experimentalBorder';
32
30
 
@@ -135,16 +133,17 @@ function BordersInspectorControl( { children, resetAllFilter } ) {
135
133
  );
136
134
  }
137
135
 
138
- export function BorderPanel( props ) {
139
- const { clientId, name, attributes, setAttributes } = props;
140
- const settings = useBlockSettings( name );
136
+ function BorderPanelPure( { clientId, name, setAttributes, settings } ) {
141
137
  const isEnabled = useHasBorderPanel( settings );
138
+ function selector( select ) {
139
+ const { style, borderColor } =
140
+ select( blockEditorStore ).getBlockAttributes( clientId ) || {};
141
+ return { style, borderColor };
142
+ }
143
+ const { style, borderColor } = useSelect( selector, [ clientId ] );
142
144
  const value = useMemo( () => {
143
- return attributesToStyle( {
144
- style: attributes.style,
145
- borderColor: attributes.borderColor,
146
- } );
147
- }, [ attributes.style, attributes.borderColor ] );
145
+ return attributesToStyle( { style, borderColor } );
146
+ }, [ style, borderColor ] );
148
147
 
149
148
  const onChange = ( newStyle ) => {
150
149
  setAttributes( styleToAttributes( newStyle ) );
@@ -154,7 +153,7 @@ export function BorderPanel( props ) {
154
153
  return null;
155
154
  }
156
155
 
157
- const defaultControls = getBlockSupport( props.name, [
156
+ const defaultControls = getBlockSupport( name, [
158
157
  BORDER_SUPPORT_KEY,
159
158
  '__experimentalDefaultControls',
160
159
  ] );
@@ -171,6 +170,11 @@ export function BorderPanel( props ) {
171
170
  );
172
171
  }
173
172
 
173
+ // We don't want block controls to re-render when typing inside a block. `pure`
174
+ // will prevent re-renders unless props change, so only pass the needed props
175
+ // and not the whole attributes object.
176
+ export const BorderPanel = pure( BorderPanelPure );
177
+
174
178
  /**
175
179
  * Determine whether there is block support for border properties.
176
180
  *
@@ -254,16 +258,16 @@ function addAttributes( settings ) {
254
258
  /**
255
259
  * Override props assigned to save component to inject border color.
256
260
  *
257
- * @param {Object} props Additional props applied to save element.
258
- * @param {Object} blockType Block type definition.
259
- * @param {Object} attributes Block's attributes.
261
+ * @param {Object} props Additional props applied to save element.
262
+ * @param {Object|string} blockNameOrType Block type definition.
263
+ * @param {Object} attributes Block's attributes.
260
264
  *
261
265
  * @return {Object} Filtered props to apply to save element.
262
266
  */
263
- function addSaveProps( props, blockType, attributes ) {
267
+ function addSaveProps( props, blockNameOrType, attributes ) {
264
268
  if (
265
- ! hasBorderSupport( blockType, 'color' ) ||
266
- shouldSkipSerialization( blockType, BORDER_SUPPORT_KEY, 'color' )
269
+ ! hasBorderSupport( blockNameOrType, 'color' ) ||
270
+ shouldSkipSerialization( blockNameOrType, BORDER_SUPPORT_KEY, 'color' )
267
271
  ) {
268
272
  return props;
269
273
  }
@@ -296,102 +300,59 @@ export function getBorderClasses( attributes ) {
296
300
  } );
297
301
  }
298
302
 
299
- /**
300
- * Filters the registered block settings to apply border color styles and
301
- * classnames to the block edit wrapper.
302
- *
303
- * @param {Object} settings Original block settings.
304
- *
305
- * @return {Object} Filtered block settings.
306
- */
307
- function addEditProps( settings ) {
303
+ function useBlockProps( { name, borderColor, style } ) {
304
+ const { colors } = useMultipleOriginColorsAndGradients();
305
+
308
306
  if (
309
- ! hasBorderSupport( settings, 'color' ) ||
310
- shouldSkipSerialization( settings, BORDER_SUPPORT_KEY, 'color' )
307
+ ! hasBorderSupport( name, 'color' ) ||
308
+ shouldSkipSerialization( name, BORDER_SUPPORT_KEY, 'color' )
311
309
  ) {
312
- return settings;
310
+ return {};
313
311
  }
314
312
 
315
- const existingGetEditWrapperProps = settings.getEditWrapperProps;
316
- settings.getEditWrapperProps = ( attributes ) => {
317
- let props = {};
313
+ const { color: borderColorValue } = getMultiOriginColor( {
314
+ colors,
315
+ namedColor: borderColor,
316
+ } );
317
+ const { color: borderTopColor } = getMultiOriginColor( {
318
+ colors,
319
+ namedColor: getColorSlugFromVariable( style?.border?.top?.color ),
320
+ } );
321
+ const { color: borderRightColor } = getMultiOriginColor( {
322
+ colors,
323
+ namedColor: getColorSlugFromVariable( style?.border?.right?.color ),
324
+ } );
318
325
 
319
- if ( existingGetEditWrapperProps ) {
320
- props = existingGetEditWrapperProps( attributes );
321
- }
326
+ const { color: borderBottomColor } = getMultiOriginColor( {
327
+ colors,
328
+ namedColor: getColorSlugFromVariable( style?.border?.bottom?.color ),
329
+ } );
330
+ const { color: borderLeftColor } = getMultiOriginColor( {
331
+ colors,
332
+ namedColor: getColorSlugFromVariable( style?.border?.left?.color ),
333
+ } );
322
334
 
323
- return addSaveProps( props, settings, attributes );
335
+ const extraStyles = {
336
+ borderTopColor: borderTopColor || borderColorValue,
337
+ borderRightColor: borderRightColor || borderColorValue,
338
+ borderBottomColor: borderBottomColor || borderColorValue,
339
+ borderLeftColor: borderLeftColor || borderColorValue,
324
340
  };
325
341
 
326
- return settings;
342
+ return addSaveProps(
343
+ { style: cleanEmptyObject( extraStyles ) || {} },
344
+ name,
345
+ { borderColor, style }
346
+ );
327
347
  }
328
348
 
329
- /**
330
- * This adds inline styles for color palette colors.
331
- * Ideally, this is not needed and themes should load their palettes on the editor.
332
- *
333
- * @param {Function} BlockListBlock Original component.
334
- *
335
- * @return {Function} Wrapped component.
336
- */
337
- export const withBorderColorPaletteStyles = createHigherOrderComponent(
338
- ( BlockListBlock ) => ( props ) => {
339
- const { name, attributes } = props;
340
- const { borderColor, style } = attributes;
341
- const { colors } = useMultipleOriginColorsAndGradients();
342
-
343
- if (
344
- ! hasBorderSupport( name, 'color' ) ||
345
- shouldSkipSerialization( name, BORDER_SUPPORT_KEY, 'color' )
346
- ) {
347
- return <BlockListBlock { ...props } />;
348
- }
349
-
350
- const { color: borderColorValue } = getMultiOriginColor( {
351
- colors,
352
- namedColor: borderColor,
353
- } );
354
- const { color: borderTopColor } = getMultiOriginColor( {
355
- colors,
356
- namedColor: getColorSlugFromVariable( style?.border?.top?.color ),
357
- } );
358
- const { color: borderRightColor } = getMultiOriginColor( {
359
- colors,
360
- namedColor: getColorSlugFromVariable( style?.border?.right?.color ),
361
- } );
362
-
363
- const { color: borderBottomColor } = getMultiOriginColor( {
364
- colors,
365
- namedColor: getColorSlugFromVariable(
366
- style?.border?.bottom?.color
367
- ),
368
- } );
369
- const { color: borderLeftColor } = getMultiOriginColor( {
370
- colors,
371
- namedColor: getColorSlugFromVariable( style?.border?.left?.color ),
372
- } );
373
-
374
- const extraStyles = {
375
- borderTopColor: borderTopColor || borderColorValue,
376
- borderRightColor: borderRightColor || borderColorValue,
377
- borderBottomColor: borderBottomColor || borderColorValue,
378
- borderLeftColor: borderLeftColor || borderColorValue,
379
- };
380
- const cleanedExtraStyles = cleanEmptyObject( extraStyles ) || {};
381
-
382
- let wrapperProps = props.wrapperProps;
383
- wrapperProps = {
384
- ...props.wrapperProps,
385
- style: {
386
- ...props.wrapperProps?.style,
387
- ...cleanedExtraStyles,
388
- },
389
- };
390
-
391
- return <BlockListBlock { ...props } wrapperProps={ wrapperProps } />;
349
+ export default {
350
+ useBlockProps,
351
+ attributeKeys: [ 'borderColor', 'style' ],
352
+ hasSupport( name ) {
353
+ return hasBorderSupport( name, 'color' );
392
354
  },
393
- 'withBorderColorPaletteStyles'
394
- );
355
+ };
395
356
 
396
357
  addFilter(
397
358
  'blocks.registerBlockType',
@@ -404,15 +365,3 @@ addFilter(
404
365
  'core/border/addSaveProps',
405
366
  addSaveProps
406
367
  );
407
-
408
- addFilter(
409
- 'blocks.registerBlockType',
410
- 'core/border/addEditProps',
411
- addEditProps
412
- );
413
-
414
- addFilter(
415
- 'editor.BlockListBlock',
416
- 'core/border/with-border-color-palette-styles',
417
- withBorderColorPaletteStyles
418
- );
@@ -9,7 +9,8 @@ import classnames from 'classnames';
9
9
  import { addFilter } from '@wordpress/hooks';
10
10
  import { getBlockSupport } from '@wordpress/blocks';
11
11
  import { useMemo, Platform, useCallback } from '@wordpress/element';
12
- import { createHigherOrderComponent } from '@wordpress/compose';
12
+ import { pure } from '@wordpress/compose';
13
+ import { useSelect } from '@wordpress/data';
13
14
 
14
15
  /**
15
16
  * Internal dependencies
@@ -23,7 +24,6 @@ import {
23
24
  cleanEmptyObject,
24
25
  transformStyles,
25
26
  shouldSkipSerialization,
26
- useBlockSettings,
27
27
  } from './utils';
28
28
  import { useSettings } from '../components/use-settings';
29
29
  import InspectorControls from '../components/inspector-controls';
@@ -32,11 +32,12 @@ import {
32
32
  default as StylesColorPanel,
33
33
  } from '../components/global-styles/color-panel';
34
34
  import BlockColorContrastChecker from './contrast-checker';
35
+ import { store as blockEditorStore } from '../store';
35
36
 
36
37
  export const COLOR_SUPPORT_KEY = 'color';
37
38
 
38
- const hasColorSupport = ( blockType ) => {
39
- const colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );
39
+ const hasColorSupport = ( blockNameOrType ) => {
40
+ const colorSupport = getBlockSupport( blockNameOrType, COLOR_SUPPORT_KEY );
40
41
  return (
41
42
  colorSupport &&
42
43
  ( colorSupport.link === true ||
@@ -60,8 +61,8 @@ const hasLinkColorSupport = ( blockType ) => {
60
61
  );
61
62
  };
62
63
 
63
- const hasGradientSupport = ( blockType ) => {
64
- const colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );
64
+ const hasGradientSupport = ( blockNameOrType ) => {
65
+ const colorSupport = getBlockSupport( blockNameOrType, COLOR_SUPPORT_KEY );
65
66
 
66
67
  return (
67
68
  colorSupport !== null &&
@@ -125,27 +126,31 @@ function addAttributes( settings ) {
125
126
  /**
126
127
  * Override props assigned to save component to inject colors classnames.
127
128
  *
128
- * @param {Object} props Additional props applied to save element.
129
- * @param {Object} blockType Block type.
130
- * @param {Object} attributes Block attributes.
129
+ * @param {Object} props Additional props applied to save element.
130
+ * @param {Object|string} blockNameOrType Block type.
131
+ * @param {Object} attributes Block attributes.
131
132
  *
132
133
  * @return {Object} Filtered props applied to save element.
133
134
  */
134
- export function addSaveProps( props, blockType, attributes ) {
135
+ export function addSaveProps( props, blockNameOrType, attributes ) {
135
136
  if (
136
- ! hasColorSupport( blockType ) ||
137
- shouldSkipSerialization( blockType, COLOR_SUPPORT_KEY )
137
+ ! hasColorSupport( blockNameOrType ) ||
138
+ shouldSkipSerialization( blockNameOrType, COLOR_SUPPORT_KEY )
138
139
  ) {
139
140
  return props;
140
141
  }
141
142
 
142
- const hasGradient = hasGradientSupport( blockType );
143
+ const hasGradient = hasGradientSupport( blockNameOrType );
143
144
 
144
145
  // I'd have preferred to avoid the "style" attribute usage here
145
146
  const { backgroundColor, textColor, gradient, style } = attributes;
146
147
 
147
148
  const shouldSerialize = ( feature ) =>
148
- ! shouldSkipSerialization( blockType, COLOR_SUPPORT_KEY, feature );
149
+ ! shouldSkipSerialization(
150
+ blockNameOrType,
151
+ COLOR_SUPPORT_KEY,
152
+ feature
153
+ );
149
154
 
150
155
  // Primary color classes must come before the `has-text-color`,
151
156
  // `has-background` and `has-link-color` classes to maintain backwards
@@ -191,33 +196,6 @@ export function addSaveProps( props, blockType, attributes ) {
191
196
  return props;
192
197
  }
193
198
 
194
- /**
195
- * Filters registered block settings to extend the block edit wrapper
196
- * to apply the desired styles and classnames properly.
197
- *
198
- * @param {Object} settings Original block settings.
199
- *
200
- * @return {Object} Filtered block settings.
201
- */
202
- export function addEditProps( settings ) {
203
- if (
204
- ! hasColorSupport( settings ) ||
205
- shouldSkipSerialization( settings, COLOR_SUPPORT_KEY )
206
- ) {
207
- return settings;
208
- }
209
- const existingGetEditWrapperProps = settings.getEditWrapperProps;
210
- settings.getEditWrapperProps = ( attributes ) => {
211
- let props = {};
212
- if ( existingGetEditWrapperProps ) {
213
- props = existingGetEditWrapperProps( attributes );
214
- }
215
- return addSaveProps( props, settings, attributes );
216
- };
217
-
218
- return settings;
219
- }
220
-
221
199
  function styleToAttributes( style ) {
222
200
  const textColorValue = style?.color?.text;
223
201
  const textColorSlug = textColorValue?.startsWith( 'var:preset|color|' )
@@ -289,23 +267,25 @@ function ColorInspectorControl( { children, resetAllFilter } ) {
289
267
  );
290
268
  }
291
269
 
292
- export function ColorEdit( props ) {
293
- const { clientId, name, attributes, setAttributes } = props;
294
- const settings = useBlockSettings( name );
270
+ function ColorEditPure( { clientId, name, setAttributes, settings } ) {
295
271
  const isEnabled = useHasColorPanel( settings );
272
+ function selector( select ) {
273
+ const { style, textColor, backgroundColor, gradient } =
274
+ select( blockEditorStore ).getBlockAttributes( clientId ) || {};
275
+ return { style, textColor, backgroundColor, gradient };
276
+ }
277
+ const { style, textColor, backgroundColor, gradient } = useSelect(
278
+ selector,
279
+ [ clientId ]
280
+ );
296
281
  const value = useMemo( () => {
297
282
  return attributesToStyle( {
298
- style: attributes.style,
299
- textColor: attributes.textColor,
300
- backgroundColor: attributes.backgroundColor,
301
- gradient: attributes.gradient,
283
+ style,
284
+ textColor,
285
+ backgroundColor,
286
+ gradient,
302
287
  } );
303
- }, [
304
- attributes.style,
305
- attributes.textColor,
306
- attributes.backgroundColor,
307
- attributes.gradient,
308
- ] );
288
+ }, [ style, textColor, backgroundColor, gradient ] );
309
289
 
310
290
  const onChange = ( newStyle ) => {
311
291
  setAttributes( styleToAttributes( newStyle ) );
@@ -315,7 +295,7 @@ export function ColorEdit( props ) {
315
295
  return null;
316
296
  }
317
297
 
318
- const defaultControls = getBlockSupport( props.name, [
298
+ const defaultControls = getBlockSupport( name, [
319
299
  COLOR_SUPPORT_KEY,
320
300
  '__experimentalDefaultControls',
321
301
  ] );
@@ -328,7 +308,7 @@ export function ColorEdit( props ) {
328
308
  // Deactivating it requires `enableContrastChecker` to have
329
309
  // an explicit value of `false`.
330
310
  false !==
331
- getBlockSupport( props.name, [
311
+ getBlockSupport( name, [
332
312
  COLOR_SUPPORT_KEY,
333
313
  'enableContrastChecker',
334
314
  ] );
@@ -343,7 +323,7 @@ export function ColorEdit( props ) {
343
323
  defaultControls={ defaultControls }
344
324
  enableContrastChecker={
345
325
  false !==
346
- getBlockSupport( props.name, [
326
+ getBlockSupport( name, [
347
327
  COLOR_SUPPORT_KEY,
348
328
  'enableContrastChecker',
349
329
  ] )
@@ -356,72 +336,72 @@ export function ColorEdit( props ) {
356
336
  );
357
337
  }
358
338
 
359
- /**
360
- * This adds inline styles for color palette colors.
361
- * Ideally, this is not needed and themes should load their palettes on the editor.
362
- *
363
- * @param {Function} BlockListBlock Original component.
364
- *
365
- * @return {Function} Wrapped component.
366
- */
367
- export const withColorPaletteStyles = createHigherOrderComponent(
368
- ( BlockListBlock ) => ( props ) => {
369
- const { name, attributes } = props;
370
- const { backgroundColor, textColor } = attributes;
371
- const [ userPalette, themePalette, defaultPalette ] = useSettings(
372
- 'color.palette.custom',
373
- 'color.palette.theme',
374
- 'color.palette.default'
375
- );
339
+ // We don't want block controls to re-render when typing inside a block. `pure`
340
+ // will prevent re-renders unless props change, so only pass the needed props
341
+ // and not the whole attributes object.
342
+ export const ColorEdit = pure( ColorEditPure );
343
+
344
+ function useBlockProps( {
345
+ name,
346
+ backgroundColor,
347
+ textColor,
348
+ gradient,
349
+ style,
350
+ } ) {
351
+ const [ userPalette, themePalette, defaultPalette ] = useSettings(
352
+ 'color.palette.custom',
353
+ 'color.palette.theme',
354
+ 'color.palette.default'
355
+ );
376
356
 
377
- const colors = useMemo(
378
- () => [
379
- ...( userPalette || [] ),
380
- ...( themePalette || [] ),
381
- ...( defaultPalette || [] ),
382
- ],
383
- [ userPalette, themePalette, defaultPalette ]
384
- );
385
- if (
386
- ! hasColorSupport( name ) ||
387
- shouldSkipSerialization( name, COLOR_SUPPORT_KEY )
388
- ) {
389
- return <BlockListBlock { ...props } />;
390
- }
391
- const extraStyles = {};
392
-
393
- if (
394
- textColor &&
395
- ! shouldSkipSerialization( name, COLOR_SUPPORT_KEY, 'text' )
396
- ) {
397
- extraStyles.color = getColorObjectByAttributeValues(
398
- colors,
399
- textColor
400
- )?.color;
401
- }
402
- if (
403
- backgroundColor &&
404
- ! shouldSkipSerialization( name, COLOR_SUPPORT_KEY, 'background' )
405
- ) {
406
- extraStyles.backgroundColor = getColorObjectByAttributeValues(
407
- colors,
408
- backgroundColor
409
- )?.color;
410
- }
357
+ const colors = useMemo(
358
+ () => [
359
+ ...( userPalette || [] ),
360
+ ...( themePalette || [] ),
361
+ ...( defaultPalette || [] ),
362
+ ],
363
+ [ userPalette, themePalette, defaultPalette ]
364
+ );
365
+ if (
366
+ ! hasColorSupport( name ) ||
367
+ shouldSkipSerialization( name, COLOR_SUPPORT_KEY )
368
+ ) {
369
+ return {};
370
+ }
371
+ const extraStyles = {};
411
372
 
412
- let wrapperProps = props.wrapperProps;
413
- wrapperProps = {
414
- ...props.wrapperProps,
415
- style: {
416
- ...extraStyles,
417
- ...props.wrapperProps?.style,
418
- },
419
- };
373
+ if (
374
+ textColor &&
375
+ ! shouldSkipSerialization( name, COLOR_SUPPORT_KEY, 'text' )
376
+ ) {
377
+ extraStyles.color = getColorObjectByAttributeValues(
378
+ colors,
379
+ textColor
380
+ )?.color;
381
+ }
382
+ if (
383
+ backgroundColor &&
384
+ ! shouldSkipSerialization( name, COLOR_SUPPORT_KEY, 'background' )
385
+ ) {
386
+ extraStyles.backgroundColor = getColorObjectByAttributeValues(
387
+ colors,
388
+ backgroundColor
389
+ )?.color;
390
+ }
420
391
 
421
- return <BlockListBlock { ...props } wrapperProps={ wrapperProps } />;
422
- },
423
- 'withColorPaletteStyles'
424
- );
392
+ return addSaveProps( { style: extraStyles }, name, {
393
+ textColor,
394
+ backgroundColor,
395
+ gradient,
396
+ style,
397
+ } );
398
+ }
399
+
400
+ export default {
401
+ useBlockProps,
402
+ attributeKeys: [ 'backgroundColor', 'textColor', 'gradient', 'style' ],
403
+ hasSupport: hasColorSupport,
404
+ };
425
405
 
426
406
  const MIGRATION_PATHS = {
427
407
  linkColor: [ [ 'style', 'elements', 'link', 'color', 'text' ] ],
@@ -463,18 +443,6 @@ addFilter(
463
443
  addSaveProps
464
444
  );
465
445
 
466
- addFilter(
467
- 'blocks.registerBlockType',
468
- 'core/color/addEditProps',
469
- addEditProps
470
- );
471
-
472
- addFilter(
473
- 'editor.BlockListBlock',
474
- 'core/color/with-color-palette-styles',
475
- withColorPaletteStyles
476
- );
477
-
478
446
  addFilter(
479
447
  'blocks.switchToBlockType.transformedBlock',
480
448
  'core/color/addTransforms',