@wordpress/block-editor 11.8.0 → 12.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (454) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +16 -4
  3. package/build/components/block-controls/slot.js +12 -4
  4. package/build/components/block-controls/slot.js.map +1 -1
  5. package/build/components/block-controls/slot.native.js +10 -1
  6. package/build/components/block-controls/slot.native.js.map +1 -1
  7. package/build/components/block-draggable/index.js +11 -7
  8. package/build/components/block-draggable/index.js.map +1 -1
  9. package/build/components/block-draggable/use-scroll-when-dragging.js +2 -2
  10. package/build/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
  11. package/build/components/block-info-slot-fill/index.js +47 -0
  12. package/build/components/block-info-slot-fill/index.js.map +1 -0
  13. package/build/components/block-inspector/index.js +4 -2
  14. package/build/components/block-inspector/index.js.map +1 -1
  15. package/build/components/block-list/block-invalid-warning.native.js +15 -7
  16. package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
  17. package/build/components/block-list/block-list-item-cell.native.js +15 -2
  18. package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
  19. package/build/components/block-list/block-list-item.native.js +158 -195
  20. package/build/components/block-list/block-list-item.native.js.map +1 -1
  21. package/build/components/block-list/block-outline.native.js +57 -0
  22. package/build/components/block-list/block-outline.native.js.map +1 -0
  23. package/build/components/block-list/block.native.js +343 -300
  24. package/build/components/block-list/block.native.js.map +1 -1
  25. package/build/components/block-list/index.native.js +202 -298
  26. package/build/components/block-list/index.native.js.map +1 -1
  27. package/build/components/block-list/insertion-point.native.js +4 -2
  28. package/build/components/block-list/insertion-point.native.js.map +1 -1
  29. package/build/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
  30. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  31. package/build/components/block-settings-menu/block-settings-dropdown.js +8 -10
  32. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  33. package/build/components/block-settings-menu-controls/index.js +15 -4
  34. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  35. package/build/components/block-toolbar/index.js +2 -1
  36. package/build/components/block-toolbar/index.js.map +1 -1
  37. package/build/components/block-tools/block-contextual-toolbar.js +40 -11
  38. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  39. package/build/components/block-tools/selected-block-popover.js +8 -30
  40. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  41. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +3 -2
  42. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  43. package/build/components/editor-styles/index.js +4 -3
  44. package/build/components/editor-styles/index.js.map +1 -1
  45. package/build/components/font-sizes/fluid-utils.js +21 -14
  46. package/build/components/font-sizes/fluid-utils.js.map +1 -1
  47. package/build/components/global-styles/advanced-panel.js +86 -0
  48. package/build/components/global-styles/advanced-panel.js.map +1 -0
  49. package/build/components/global-styles/border-panel.js +2 -32
  50. package/build/components/global-styles/border-panel.js.map +1 -1
  51. package/build/components/global-styles/color-panel.js +16 -13
  52. package/build/components/global-styles/color-panel.js.map +1 -1
  53. package/build/components/global-styles/color-panel.native.js +174 -0
  54. package/build/components/global-styles/color-panel.native.js.map +1 -0
  55. package/build/components/global-styles/dimensions-panel.js +12 -12
  56. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  57. package/build/components/global-styles/effects-panel.js +1 -1
  58. package/build/components/global-styles/effects-panel.js.map +1 -1
  59. package/build/components/global-styles/filters-panel.js +78 -14
  60. package/build/components/global-styles/filters-panel.js.map +1 -1
  61. package/build/components/global-styles/hooks.js +1 -2
  62. package/build/components/global-styles/hooks.js.map +1 -1
  63. package/build/components/global-styles/index.js +24 -0
  64. package/build/components/global-styles/index.js.map +1 -1
  65. package/build/components/global-styles/typography-panel.js +10 -10
  66. package/build/components/global-styles/typography-panel.js.map +1 -1
  67. package/build/components/global-styles/use-global-styles-output.js +114 -81
  68. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  69. package/build/components/global-styles/utils.js +30 -0
  70. package/build/components/global-styles/utils.js.map +1 -1
  71. package/build/components/image-editor/use-save-image.js +24 -8
  72. package/build/components/image-editor/use-save-image.js.map +1 -1
  73. package/build/components/index.js +7 -0
  74. package/build/components/index.js.map +1 -1
  75. package/build/components/inserter/block-types-tab.js +12 -7
  76. package/build/components/inserter/block-types-tab.js.map +1 -1
  77. package/build/components/inserter/index.js +2 -1
  78. package/build/components/inserter/index.js.map +1 -1
  79. package/build/components/inserter-draggable-blocks/index.js +5 -0
  80. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  81. package/build/components/inspector-controls/fill.js +1 -1
  82. package/build/components/inspector-controls/fill.js.map +1 -1
  83. package/build/components/inspector-controls/fill.native.js +1 -1
  84. package/build/components/inspector-controls/fill.native.js.map +1 -1
  85. package/build/components/inspector-controls/groups.js +2 -0
  86. package/build/components/inspector-controls/groups.js.map +1 -1
  87. package/build/components/inspector-controls/slot.js +3 -6
  88. package/build/components/inspector-controls/slot.js.map +1 -1
  89. package/build/components/inspector-controls/slot.native.js +1 -1
  90. package/build/components/inspector-controls/slot.native.js.map +1 -1
  91. package/build/components/inspector-controls-tabs/styles-tab.js +2 -0
  92. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  93. package/build/components/line-height-control/index.js +7 -2
  94. package/build/components/line-height-control/index.js.map +1 -1
  95. package/build/components/link-control/use-internal-input-value.js +9 -8
  96. package/build/components/link-control/use-internal-input-value.js.map +1 -1
  97. package/build/components/list-view/block-contents.js +7 -2
  98. package/build/components/list-view/block-contents.js.map +1 -1
  99. package/build/components/list-view/block-select-button.js +9 -3
  100. package/build/components/list-view/block-select-button.js.map +1 -1
  101. package/build/components/list-view/block.js +16 -25
  102. package/build/components/list-view/block.js.map +1 -1
  103. package/build/components/list-view/drop-indicator.js +37 -10
  104. package/build/components/list-view/drop-indicator.js.map +1 -1
  105. package/build/components/list-view/index.js +38 -18
  106. package/build/components/list-view/index.js.map +1 -1
  107. package/build/components/list-view/leaf.js +2 -1
  108. package/build/components/list-view/leaf.js.map +1 -1
  109. package/build/components/list-view/use-block-selection.js +1 -1
  110. package/build/components/list-view/use-block-selection.js.map +1 -1
  111. package/build/components/list-view/use-list-view-drop-zone.js +163 -11
  112. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  113. package/build/components/media-placeholder/index.js +68 -7
  114. package/build/components/media-placeholder/index.js.map +1 -1
  115. package/build/components/media-replace-flow/index.js +5 -5
  116. package/build/components/media-replace-flow/index.js.map +1 -1
  117. package/build/components/multi-selection-inspector/index.js +2 -2
  118. package/build/components/multi-selection-inspector/index.js.map +1 -1
  119. package/build/components/navigable-toolbar/index.js +12 -4
  120. package/build/components/navigable-toolbar/index.js.map +1 -1
  121. package/build/components/off-canvas-editor/appender.js +2 -7
  122. package/build/components/off-canvas-editor/appender.js.map +1 -1
  123. package/build/components/off-canvas-editor/leaf-more-menu.js +3 -1
  124. package/build/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
  125. package/build/components/preview-options/index.js +6 -1
  126. package/build/components/preview-options/index.js.map +1 -1
  127. package/build/components/spacing-sizes-control/spacing-input-control.js +1 -1
  128. package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  129. package/build/components/url-input/index.js +1 -2
  130. package/build/components/url-input/index.js.map +1 -1
  131. package/build/hooks/align.js +1 -1
  132. package/build/hooks/align.js.map +1 -1
  133. package/build/hooks/border.js +1 -1
  134. package/build/hooks/border.js.map +1 -1
  135. package/build/hooks/color.js +1 -1
  136. package/build/hooks/color.js.map +1 -1
  137. package/build/hooks/content-lock-ui.js +8 -12
  138. package/build/hooks/content-lock-ui.js.map +1 -1
  139. package/build/hooks/duotone.js +29 -4
  140. package/build/hooks/duotone.js.map +1 -1
  141. package/build/hooks/index.native.js +8 -0
  142. package/build/hooks/index.native.js.map +1 -1
  143. package/build/hooks/layout.js +2 -2
  144. package/build/hooks/layout.js.map +1 -1
  145. package/build/hooks/position.js +1 -1
  146. package/build/hooks/position.js.map +1 -1
  147. package/build/hooks/style.js +1 -1
  148. package/build/hooks/style.js.map +1 -1
  149. package/build/hooks/use-editor-wrapper-styles.native.js +255 -0
  150. package/build/hooks/use-editor-wrapper-styles.native.js.map +1 -0
  151. package/build/hooks/use-typography-props.js +14 -10
  152. package/build/hooks/use-typography-props.js.map +1 -1
  153. package/build/hooks/utils.js +15 -3
  154. package/build/hooks/utils.js.map +1 -1
  155. package/build/index.native.js +31 -0
  156. package/build/index.native.js.map +1 -0
  157. package/build/private-apis.js +10 -1
  158. package/build/private-apis.js.map +1 -1
  159. package/build/store/actions.js +7 -0
  160. package/build/store/actions.js.map +1 -1
  161. package/build/utils/object.js +5 -5
  162. package/build/utils/object.js.map +1 -1
  163. package/build/utils/transform-styles/index.js +2 -2
  164. package/build/utils/transform-styles/index.js.map +1 -1
  165. package/build/utils/use-should-contextual-toolbar-show.js +72 -0
  166. package/build/utils/use-should-contextual-toolbar-show.js.map +1 -0
  167. package/build-module/components/block-controls/slot.js +11 -4
  168. package/build-module/components/block-controls/slot.js.map +1 -1
  169. package/build-module/components/block-controls/slot.native.js +9 -1
  170. package/build-module/components/block-controls/slot.native.js.map +1 -1
  171. package/build-module/components/block-draggable/index.js +10 -6
  172. package/build-module/components/block-draggable/index.js.map +1 -1
  173. package/build-module/components/block-draggable/use-scroll-when-dragging.js +2 -2
  174. package/build-module/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
  175. package/build-module/components/block-info-slot-fill/index.js +34 -0
  176. package/build-module/components/block-info-slot-fill/index.js.map +1 -0
  177. package/build-module/components/block-inspector/index.js +3 -2
  178. package/build-module/components/block-inspector/index.js.map +1 -1
  179. package/build-module/components/block-list/block-invalid-warning.native.js +16 -8
  180. package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
  181. package/build-module/components/block-list/block-list-item-cell.native.js +13 -2
  182. package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -1
  183. package/build-module/components/block-list/block-list-item.native.js +160 -190
  184. package/build-module/components/block-list/block-list-item.native.js.map +1 -1
  185. package/build-module/components/block-list/block-outline.native.js +44 -0
  186. package/build-module/components/block-list/block-outline.native.js.map +1 -0
  187. package/build-module/components/block-list/block.native.js +341 -299
  188. package/build-module/components/block-list/block.native.js.map +1 -1
  189. package/build-module/components/block-list/index.native.js +203 -293
  190. package/build-module/components/block-list/index.native.js.map +1 -1
  191. package/build-module/components/block-list/insertion-point.native.js +4 -2
  192. package/build-module/components/block-list/insertion-point.native.js.map +1 -1
  193. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
  194. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  195. package/build-module/components/block-settings-menu/block-settings-dropdown.js +8 -9
  196. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  197. package/build-module/components/block-settings-menu-controls/index.js +13 -5
  198. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  199. package/build-module/components/block-toolbar/index.js +2 -1
  200. package/build-module/components/block-toolbar/index.js.map +1 -1
  201. package/build-module/components/block-tools/block-contextual-toolbar.js +37 -11
  202. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  203. package/build-module/components/block-tools/selected-block-popover.js +8 -29
  204. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  205. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +3 -2
  206. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  207. package/build-module/components/editor-styles/index.js +4 -3
  208. package/build-module/components/editor-styles/index.js.map +1 -1
  209. package/build-module/components/font-sizes/fluid-utils.js +21 -14
  210. package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
  211. package/build-module/components/global-styles/advanced-panel.js +74 -0
  212. package/build-module/components/global-styles/advanced-panel.js.map +1 -0
  213. package/build-module/components/global-styles/border-panel.js +2 -32
  214. package/build-module/components/global-styles/border-panel.js.map +1 -1
  215. package/build-module/components/global-styles/color-panel.js +18 -15
  216. package/build-module/components/global-styles/color-panel.js.map +1 -1
  217. package/build-module/components/global-styles/color-panel.native.js +150 -0
  218. package/build-module/components/global-styles/color-panel.native.js.map +1 -0
  219. package/build-module/components/global-styles/dimensions-panel.js +13 -13
  220. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  221. package/build-module/components/global-styles/effects-panel.js +2 -2
  222. package/build-module/components/global-styles/effects-panel.js.map +1 -1
  223. package/build-module/components/global-styles/filters-panel.js +78 -16
  224. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  225. package/build-module/components/global-styles/hooks.js +1 -2
  226. package/build-module/components/global-styles/hooks.js.map +1 -1
  227. package/build-module/components/global-styles/index.js +3 -1
  228. package/build-module/components/global-styles/index.js.map +1 -1
  229. package/build-module/components/global-styles/typography-panel.js +11 -11
  230. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  231. package/build-module/components/global-styles/use-global-styles-output.js +112 -81
  232. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  233. package/build-module/components/global-styles/utils.js +25 -0
  234. package/build-module/components/global-styles/utils.js.map +1 -1
  235. package/build-module/components/image-editor/use-save-image.js +24 -8
  236. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  237. package/build-module/components/index.js +1 -1
  238. package/build-module/components/index.js.map +1 -1
  239. package/build-module/components/inserter/block-types-tab.js +12 -6
  240. package/build-module/components/inserter/block-types-tab.js.map +1 -1
  241. package/build-module/components/inserter/index.js +2 -1
  242. package/build-module/components/inserter/index.js.map +1 -1
  243. package/build-module/components/inserter-draggable-blocks/index.js +4 -0
  244. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  245. package/build-module/components/inspector-controls/fill.js +1 -1
  246. package/build-module/components/inspector-controls/fill.js.map +1 -1
  247. package/build-module/components/inspector-controls/fill.native.js +1 -1
  248. package/build-module/components/inspector-controls/fill.native.js.map +1 -1
  249. package/build-module/components/inspector-controls/groups.js +2 -0
  250. package/build-module/components/inspector-controls/groups.js.map +1 -1
  251. package/build-module/components/inspector-controls/slot.js +4 -7
  252. package/build-module/components/inspector-controls/slot.js.map +1 -1
  253. package/build-module/components/inspector-controls/slot.native.js +1 -1
  254. package/build-module/components/inspector-controls/slot.native.js.map +1 -1
  255. package/build-module/components/inspector-controls-tabs/styles-tab.js +2 -0
  256. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  257. package/build-module/components/line-height-control/index.js +7 -2
  258. package/build-module/components/line-height-control/index.js.map +1 -1
  259. package/build-module/components/link-control/use-internal-input-value.js +9 -8
  260. package/build-module/components/link-control/use-internal-input-value.js.map +1 -1
  261. package/build-module/components/list-view/block-contents.js +7 -3
  262. package/build-module/components/list-view/block-contents.js.map +1 -1
  263. package/build-module/components/list-view/block-select-button.js +9 -3
  264. package/build-module/components/list-view/block-select-button.js.map +1 -1
  265. package/build-module/components/list-view/block.js +18 -26
  266. package/build-module/components/list-view/block.js.map +1 -1
  267. package/build-module/components/list-view/drop-indicator.js +36 -10
  268. package/build-module/components/list-view/drop-indicator.js.map +1 -1
  269. package/build-module/components/list-view/index.js +39 -19
  270. package/build-module/components/list-view/index.js.map +1 -1
  271. package/build-module/components/list-view/leaf.js +2 -1
  272. package/build-module/components/list-view/leaf.js.map +1 -1
  273. package/build-module/components/list-view/use-block-selection.js +1 -1
  274. package/build-module/components/list-view/use-block-selection.js.map +1 -1
  275. package/build-module/components/list-view/use-list-view-drop-zone.js +160 -11
  276. package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
  277. package/build-module/components/media-placeholder/index.js +66 -7
  278. package/build-module/components/media-placeholder/index.js.map +1 -1
  279. package/build-module/components/media-replace-flow/index.js +5 -5
  280. package/build-module/components/media-replace-flow/index.js.map +1 -1
  281. package/build-module/components/multi-selection-inspector/index.js +2 -2
  282. package/build-module/components/multi-selection-inspector/index.js.map +1 -1
  283. package/build-module/components/navigable-toolbar/index.js +12 -4
  284. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  285. package/build-module/components/off-canvas-editor/appender.js +1 -5
  286. package/build-module/components/off-canvas-editor/appender.js.map +1 -1
  287. package/build-module/components/off-canvas-editor/leaf-more-menu.js +3 -1
  288. package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
  289. package/build-module/components/preview-options/index.js +7 -2
  290. package/build-module/components/preview-options/index.js.map +1 -1
  291. package/build-module/components/spacing-sizes-control/spacing-input-control.js +1 -1
  292. package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  293. package/build-module/components/url-input/index.js +1 -2
  294. package/build-module/components/url-input/index.js.map +1 -1
  295. package/build-module/hooks/align.js +1 -1
  296. package/build-module/hooks/align.js.map +1 -1
  297. package/build-module/hooks/border.js +1 -1
  298. package/build-module/hooks/border.js.map +1 -1
  299. package/build-module/hooks/color.js +1 -1
  300. package/build-module/hooks/color.js.map +1 -1
  301. package/build-module/hooks/content-lock-ui.js +8 -11
  302. package/build-module/hooks/content-lock-ui.js.map +1 -1
  303. package/build-module/hooks/duotone.js +28 -5
  304. package/build-module/hooks/duotone.js.map +1 -1
  305. package/build-module/hooks/index.native.js +1 -0
  306. package/build-module/hooks/index.native.js.map +1 -1
  307. package/build-module/hooks/layout.js +2 -2
  308. package/build-module/hooks/layout.js.map +1 -1
  309. package/build-module/hooks/position.js +1 -1
  310. package/build-module/hooks/position.js.map +1 -1
  311. package/build-module/hooks/style.js +1 -1
  312. package/build-module/hooks/style.js.map +1 -1
  313. package/build-module/hooks/use-editor-wrapper-styles.native.js +242 -0
  314. package/build-module/hooks/use-editor-wrapper-styles.native.js.map +1 -0
  315. package/build-module/hooks/use-typography-props.js +14 -10
  316. package/build-module/hooks/use-typography-props.js.map +1 -1
  317. package/build-module/hooks/utils.js +16 -4
  318. package/build-module/hooks/utils.js.map +1 -1
  319. package/build-module/index.native.js +6 -0
  320. package/build-module/index.native.js.map +1 -0
  321. package/build-module/private-apis.js +7 -1
  322. package/build-module/private-apis.js.map +1 -1
  323. package/build-module/store/actions.js +7 -0
  324. package/build-module/store/actions.js.map +1 -1
  325. package/build-module/utils/object.js +4 -4
  326. package/build-module/utils/object.js.map +1 -1
  327. package/build-module/utils/transform-styles/index.js +2 -2
  328. package/build-module/utils/transform-styles/index.js.map +1 -1
  329. package/build-module/utils/use-should-contextual-toolbar-show.js +60 -0
  330. package/build-module/utils/use-should-contextual-toolbar-show.js.map +1 -0
  331. package/build-style/content-rtl.css +9 -7
  332. package/build-style/content.css +9 -7
  333. package/build-style/style-rtl.css +257 -56
  334. package/build-style/style.css +257 -56
  335. package/package.json +32 -32
  336. package/src/components/block-breadcrumb/style.scss +2 -1
  337. package/src/components/block-controls/slot.js +8 -4
  338. package/src/components/block-controls/slot.native.js +6 -1
  339. package/src/components/block-draggable/index.js +10 -6
  340. package/src/components/block-draggable/use-scroll-when-dragging.js +8 -2
  341. package/src/components/block-info-slot-fill/index.js +24 -0
  342. package/src/components/block-inspector/index.js +3 -0
  343. package/src/components/block-list/block-invalid-warning.native.js +17 -9
  344. package/src/components/block-list/block-list-item-cell.native.js +10 -1
  345. package/src/components/block-list/block-list-item.native.js +180 -208
  346. package/src/components/block-list/block-outline.native.js +58 -0
  347. package/src/components/block-list/block.native.js +564 -524
  348. package/src/components/block-list/content.scss +16 -16
  349. package/src/components/block-list/index.native.js +229 -298
  350. package/src/components/block-list/insertion-point.native.js +2 -2
  351. package/src/components/block-list/test/block-invalid-warning.native.js +48 -0
  352. package/src/components/block-list/test/index.native.js +205 -0
  353. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +3 -1
  354. package/src/components/block-mobile-toolbar/test/block-actions-menu.native.js +9 -9
  355. package/src/components/block-mover/style.scss +10 -4
  356. package/src/components/block-mover/test/index.native.js +4 -4
  357. package/src/components/block-pattern-setup/style.scss +1 -4
  358. package/src/components/block-patterns-list/style.scss +1 -4
  359. package/src/components/block-settings-menu/block-settings-dropdown.js +10 -17
  360. package/src/components/block-settings-menu-controls/index.js +24 -4
  361. package/src/components/block-styles/style.scss +4 -4
  362. package/src/components/block-toolbar/index.js +4 -3
  363. package/src/components/block-toolbar/style.scss +56 -33
  364. package/src/components/block-tools/block-contextual-toolbar.js +64 -15
  365. package/src/components/block-tools/selected-block-popover.js +11 -46
  366. package/src/components/block-tools/style.scss +165 -3
  367. package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +16 -2
  368. package/src/components/editor-styles/index.js +9 -5
  369. package/src/components/font-sizes/fluid-utils.js +31 -14
  370. package/src/components/font-sizes/test/fluid-utils.js +5 -16
  371. package/src/components/global-styles/advanced-panel.js +82 -0
  372. package/src/components/global-styles/border-panel.js +1 -30
  373. package/src/components/global-styles/color-panel.js +19 -14
  374. package/src/components/global-styles/color-panel.native.js +207 -0
  375. package/src/components/global-styles/dimensions-panel.js +23 -13
  376. package/src/components/global-styles/effects-panel.js +2 -2
  377. package/src/components/global-styles/filters-panel.js +90 -17
  378. package/src/components/global-styles/hooks.js +1 -5
  379. package/src/components/global-styles/index.js +6 -1
  380. package/src/components/global-styles/style.scss +16 -1
  381. package/src/components/global-styles/test/typography-utils.js +63 -22
  382. package/src/components/global-styles/test/use-global-styles-output.js +126 -4
  383. package/src/components/global-styles/test/utils.js +57 -1
  384. package/src/components/global-styles/typography-panel.js +38 -12
  385. package/src/components/global-styles/use-global-styles-output.js +85 -67
  386. package/src/components/global-styles/utils.js +27 -0
  387. package/src/components/image-editor/use-save-image.js +20 -9
  388. package/src/components/index.js +1 -0
  389. package/src/components/inserter/block-types-tab.js +9 -6
  390. package/src/components/inserter/index.js +1 -1
  391. package/src/components/inserter-draggable-blocks/index.js +4 -0
  392. package/src/components/inspector-controls/fill.js +1 -1
  393. package/src/components/inspector-controls/fill.native.js +1 -1
  394. package/src/components/inspector-controls/groups.js +2 -0
  395. package/src/components/inspector-controls/slot.js +4 -9
  396. package/src/components/inspector-controls/slot.native.js +1 -1
  397. package/src/components/inspector-controls-tabs/styles-tab.js +1 -0
  398. package/src/components/line-height-control/index.js +7 -2
  399. package/src/components/line-height-control/stories/index.js +1 -1
  400. package/src/components/link-control/test/index.js +42 -0
  401. package/src/components/link-control/use-internal-input-value.js +8 -7
  402. package/src/components/list-view/block-contents.js +26 -20
  403. package/src/components/list-view/block-select-button.js +11 -2
  404. package/src/components/list-view/block.js +28 -33
  405. package/src/components/list-view/drop-indicator.js +67 -22
  406. package/src/components/list-view/index.js +33 -14
  407. package/src/components/list-view/leaf.js +1 -0
  408. package/src/components/list-view/style.scss +18 -3
  409. package/src/components/list-view/test/use-list-view-drop-zone.js +88 -12
  410. package/src/components/list-view/use-block-selection.js +1 -1
  411. package/src/components/list-view/use-list-view-drop-zone.js +194 -11
  412. package/src/components/media-placeholder/index.js +74 -1
  413. package/src/components/media-replace-flow/README.md +3 -2
  414. package/src/components/media-replace-flow/index.js +4 -5
  415. package/src/components/multi-selection-inspector/index.js +2 -2
  416. package/src/components/navigable-toolbar/index.js +12 -3
  417. package/src/components/off-canvas-editor/appender.js +1 -4
  418. package/src/components/off-canvas-editor/leaf-more-menu.js +2 -1
  419. package/src/components/preview-options/index.js +9 -2
  420. package/src/components/spacing-sizes-control/spacing-input-control.js +1 -0
  421. package/src/components/url-input/index.js +1 -2
  422. package/src/components/url-popover/test/__snapshots__/index.js.snap +3 -3
  423. package/src/hooks/align.js +2 -1
  424. package/src/hooks/border.js +2 -1
  425. package/src/hooks/color.js +2 -1
  426. package/src/hooks/content-lock-ui.js +3 -15
  427. package/src/hooks/duotone.js +47 -25
  428. package/src/hooks/index.native.js +1 -0
  429. package/src/hooks/layout.js +4 -2
  430. package/src/hooks/position.js +2 -1
  431. package/src/hooks/style.js +2 -1
  432. package/src/hooks/test/anchor.js +113 -0
  433. package/src/hooks/test/color.js +0 -9
  434. package/src/hooks/test/use-editor-wrapper-styles.native.js +282 -0
  435. package/src/hooks/test/use-typography-props.js +49 -4
  436. package/src/hooks/test/utils.js +20 -101
  437. package/src/hooks/use-editor-wrapper-styles.native.js +250 -0
  438. package/src/hooks/use-editor-wrapper-styles.native.scss +11 -0
  439. package/src/hooks/use-typography-props.js +10 -11
  440. package/src/hooks/utils.js +20 -3
  441. package/src/index.native.js +6 -0
  442. package/src/private-apis.js +6 -0
  443. package/src/store/actions.js +7 -0
  444. package/src/utils/object.js +4 -4
  445. package/src/utils/test/object.js +21 -21
  446. package/src/utils/transform-styles/index.js +2 -2
  447. package/src/utils/use-should-contextual-toolbar-show.js +85 -0
  448. package/tsconfig.json +2 -0
  449. package/tsconfig.tsbuildinfo +1 -1
  450. package/build/hooks/color-panel.native.js +0 -77
  451. package/build/hooks/color-panel.native.js.map +0 -1
  452. package/build-module/hooks/color-panel.native.js +0 -62
  453. package/build-module/hooks/color-panel.native.js.map +0 -1
  454. package/src/hooks/color-panel.native.js +0 -63
@@ -20,7 +20,7 @@ import LetterSpacingControl from '../letter-spacing-control';
20
20
  import TextTransformControl from '../text-transform-control';
21
21
  import TextDecorationControl from '../text-decoration-control';
22
22
  import { getValueFromVariable } from './utils';
23
- import { immutableSet } from '../../utils/object';
23
+ import { setImmutably } from '../../utils/object';
24
24
 
25
25
  const MIN_TEXT_COLUMNS = 1;
26
26
  const MAX_TEXT_COLUMNS = 6;
@@ -163,10 +163,12 @@ export default function TypographyPanel( {
163
163
  ( { fontFamily: f } ) => f === newValue
164
164
  )?.slug;
165
165
  onChange(
166
- immutableSet(
166
+ setImmutably(
167
167
  value,
168
168
  [ 'typography', 'fontFamily' ],
169
- slug ? `var:preset|font-family|${ slug }` : newValue
169
+ slug
170
+ ? `var:preset|font-family|${ slug }`
171
+ : newValue || undefined
170
172
  )
171
173
  );
172
174
  };
@@ -188,7 +190,11 @@ export default function TypographyPanel( {
188
190
  : newValue;
189
191
 
190
192
  onChange(
191
- immutableSet( value, [ 'typography', 'fontSize' ], actualValue )
193
+ setImmutably(
194
+ value,
195
+ [ 'typography', 'fontSize' ],
196
+ actualValue || undefined
197
+ )
192
198
  );
193
199
  };
194
200
  const hasFontSize = () => !! value?.typography?.fontSize;
@@ -209,8 +215,8 @@ export default function TypographyPanel( {
209
215
  ...value,
210
216
  typography: {
211
217
  ...value?.typography,
212
- fontStyle: newFontStyle,
213
- fontWeight: newFontWeight,
218
+ fontStyle: newFontStyle || undefined,
219
+ fontWeight: newFontWeight || undefined,
214
220
  },
215
221
  } );
216
222
  };
@@ -225,10 +231,14 @@ export default function TypographyPanel( {
225
231
  const lineHeight = decodeValue( inheritedValue?.typography?.lineHeight );
226
232
  const setLineHeight = ( newValue ) => {
227
233
  onChange(
228
- immutableSet( value, [ 'typography', 'lineHeight' ], newValue )
234
+ setImmutably(
235
+ value,
236
+ [ 'typography', 'lineHeight' ],
237
+ newValue || undefined
238
+ )
229
239
  );
230
240
  };
231
- const hasLineHeight = () => !! value?.typography?.lineHeight;
241
+ const hasLineHeight = () => value?.typography?.lineHeight !== undefined;
232
242
  const resetLineHeight = () => setLineHeight( undefined );
233
243
 
234
244
  // Letter Spacing
@@ -238,7 +248,11 @@ export default function TypographyPanel( {
238
248
  );
239
249
  const setLetterSpacing = ( newValue ) => {
240
250
  onChange(
241
- immutableSet( value, [ 'typography', 'letterSpacing' ], newValue )
251
+ setImmutably(
252
+ value,
253
+ [ 'typography', 'letterSpacing' ],
254
+ newValue || undefined
255
+ )
242
256
  );
243
257
  };
244
258
  const hasLetterSpacing = () => !! value?.typography?.letterSpacing;
@@ -249,7 +263,11 @@ export default function TypographyPanel( {
249
263
  const textColumns = decodeValue( inheritedValue?.typography?.textColumns );
250
264
  const setTextColumns = ( newValue ) => {
251
265
  onChange(
252
- immutableSet( value, [ 'typography', 'textColumns' ], newValue )
266
+ setImmutably(
267
+ value,
268
+ [ 'typography', 'textColumns' ],
269
+ newValue || undefined
270
+ )
253
271
  );
254
272
  };
255
273
  const hasTextColumns = () => !! value?.typography?.textColumns;
@@ -262,7 +280,11 @@ export default function TypographyPanel( {
262
280
  );
263
281
  const setTextTransform = ( newValue ) => {
264
282
  onChange(
265
- immutableSet( value, [ 'typography', 'textTransform' ], newValue )
283
+ setImmutably(
284
+ value,
285
+ [ 'typography', 'textTransform' ],
286
+ newValue || undefined
287
+ )
266
288
  );
267
289
  };
268
290
  const hasTextTransform = () => !! value?.typography?.textTransform;
@@ -275,7 +297,11 @@ export default function TypographyPanel( {
275
297
  );
276
298
  const setTextDecoration = ( newValue ) => {
277
299
  onChange(
278
- immutableSet( value, [ 'typography', 'textDecoration' ], newValue )
300
+ setImmutably(
301
+ value,
302
+ [ 'typography', 'textDecoration' ],
303
+ newValue || undefined
304
+ )
279
305
  );
280
306
  };
281
307
  const hasTextDecoration = () => !! value?.typography?.textDecoration;
@@ -325,7 +325,7 @@ export function getStylesDeclarations(
325
325
  return declarations;
326
326
  }
327
327
 
328
- if ( !! properties && typeof styleValue !== 'string' ) {
328
+ if ( properties && typeof styleValue !== 'string' ) {
329
329
  Object.entries( properties ).forEach( ( entry ) => {
330
330
  const [ name, prop ] = entry;
331
331
 
@@ -382,7 +382,7 @@ export function getStylesDeclarations(
382
382
  ruleValue = get( tree, refPath );
383
383
  // Presence of another ref indicates a reference to another dynamic value.
384
384
  // Pointing to another dynamic value is not supported.
385
- if ( ! ruleValue || !! ruleValue?.ref ) {
385
+ if ( ! ruleValue || ruleValue?.ref ) {
386
386
  return;
387
387
  }
388
388
  }
@@ -551,6 +551,33 @@ export function getLayoutStyles( {
551
551
  return ruleset;
552
552
  }
553
553
 
554
+ const STYLE_KEYS = [
555
+ 'border',
556
+ 'color',
557
+ 'dimensions',
558
+ 'spacing',
559
+ 'typography',
560
+ 'filter',
561
+ 'outline',
562
+ 'shadow',
563
+ ];
564
+
565
+ function pickStyleKeys( treeToPickFrom ) {
566
+ if ( ! treeToPickFrom ) {
567
+ return {};
568
+ }
569
+ const entries = Object.entries( treeToPickFrom );
570
+ const pickedEntries = entries.filter( ( [ key ] ) =>
571
+ STYLE_KEYS.includes( key )
572
+ );
573
+ // clone the style objects so that `getFeatureDeclarations` can remove consumed keys from it
574
+ const clonedEntries = pickedEntries.map( ( [ key, style ] ) => [
575
+ key,
576
+ JSON.parse( JSON.stringify( style ) ),
577
+ ] );
578
+ return Object.fromEntries( clonedEntries );
579
+ }
580
+
554
581
  export const getNodesWithStyles = ( tree, blockSelectors ) => {
555
582
  const nodes = [];
556
583
 
@@ -558,25 +585,9 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
558
585
  return nodes;
559
586
  }
560
587
 
561
- const pickStyleKeys = ( treeToPickFrom ) =>
562
- Object.fromEntries(
563
- Object.entries( treeToPickFrom ?? {} ).filter( ( [ key ] ) =>
564
- [
565
- 'border',
566
- 'color',
567
- 'dimensions',
568
- 'spacing',
569
- 'typography',
570
- 'filter',
571
- 'outline',
572
- 'shadow',
573
- ].includes( key )
574
- )
575
- );
576
-
577
588
  // Top-level.
578
589
  const styles = pickStyleKeys( tree.styles );
579
- if ( !! styles ) {
590
+ if ( styles ) {
580
591
  nodes.push( {
581
592
  styles,
582
593
  selector: ROOT_BLOCK_SELECTOR,
@@ -584,7 +595,7 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
584
595
  }
585
596
 
586
597
  Object.entries( ELEMENTS ).forEach( ( [ name, selector ] ) => {
587
- if ( !! tree.styles?.elements?.[ name ] ) {
598
+ if ( tree.styles?.elements?.[ name ] ) {
588
599
  nodes.push( {
589
600
  styles: tree.styles?.elements?.[ name ],
590
601
  selector,
@@ -606,10 +617,7 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
606
617
  } );
607
618
  blockStyles.variations = variations;
608
619
  }
609
- if (
610
- !! blockStyles &&
611
- !! blockSelectors?.[ blockName ]?.selector
612
- ) {
620
+ if ( blockStyles && blockSelectors?.[ blockName ]?.selector ) {
613
621
  nodes.push( {
614
622
  duotoneSelector:
615
623
  blockSelectors[ blockName ].duotoneSelector,
@@ -617,7 +625,7 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
617
625
  blockSelectors[ blockName ].fallbackGapValue,
618
626
  hasLayoutSupport:
619
627
  blockSelectors[ blockName ].hasLayoutSupport,
620
- selector: blockSelectors[ blockName ]?.selector,
628
+ selector: blockSelectors[ blockName ].selector,
621
629
  styles: blockStyles,
622
630
  featureSelectors:
623
631
  blockSelectors[ blockName ].featureSelectors,
@@ -629,9 +637,9 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
629
637
  Object.entries( node?.elements ?? {} ).forEach(
630
638
  ( [ elementName, value ] ) => {
631
639
  if (
632
- !! value &&
633
- !! blockSelectors?.[ blockName ] &&
634
- !! ELEMENTS?.[ elementName ]
640
+ value &&
641
+ blockSelectors?.[ blockName ] &&
642
+ ELEMENTS[ elementName ]
635
643
  ) {
636
644
  nodes.push( {
637
645
  styles: value,
@@ -677,7 +685,7 @@ export const getNodesWithSettings = ( tree, blockSelectors ) => {
677
685
  // Top-level.
678
686
  const presets = pickPresets( tree.settings );
679
687
  const custom = tree.settings?.custom;
680
- if ( ! isEmpty( presets ) || !! custom ) {
688
+ if ( ! isEmpty( presets ) || custom ) {
681
689
  nodes.push( {
682
690
  presets,
683
691
  custom,
@@ -690,7 +698,7 @@ export const getNodesWithSettings = ( tree, blockSelectors ) => {
690
698
  ( [ blockName, node ] ) => {
691
699
  const blockPresets = pickPresets( node );
692
700
  const blockCustom = node.custom;
693
- if ( ! isEmpty( blockPresets ) || !! blockCustom ) {
701
+ if ( ! isEmpty( blockPresets ) || blockCustom ) {
694
702
  nodes.push( {
695
703
  presets: blockPresets,
696
704
  custom: blockCustom,
@@ -714,7 +722,7 @@ export const toCustomProperties = ( tree, blockSelectors ) => {
714
722
  }
715
723
 
716
724
  if ( declarations.length > 0 ) {
717
- ruleset = ruleset + `${ selector }{${ declarations.join( ';' ) };}`;
725
+ ruleset += `${ selector }{${ declarations.join( ';' ) };}`;
718
726
  }
719
727
  } );
720
728
 
@@ -787,9 +795,9 @@ export const toStyles = (
787
795
 
788
796
  Object.entries( featureDeclarations ).forEach(
789
797
  ( [ cssSelector, declarations ] ) => {
790
- if ( !! declarations.length ) {
798
+ if ( declarations.length ) {
791
799
  const rules = declarations.join( ';' );
792
- ruleset = ruleset + `${ cssSelector }{${ rules }}`;
800
+ ruleset += `${ cssSelector }{${ rules };}`;
793
801
  }
794
802
  }
795
803
  );
@@ -798,20 +806,20 @@ export const toStyles = (
798
806
  if ( styleVariationSelectors ) {
799
807
  Object.entries( styleVariationSelectors ).forEach(
800
808
  ( [ styleVariationName, styleVariationSelector ] ) => {
801
- if ( styles?.variations?.[ styleVariationName ] ) {
809
+ const styleVariations =
810
+ styles?.variations?.[ styleVariationName ];
811
+ if ( styleVariations ) {
802
812
  // If the block uses any custom selectors for block support, add those first.
803
813
  if ( featureSelectors ) {
804
814
  const featureDeclarations =
805
815
  getFeatureDeclarations(
806
816
  featureSelectors,
807
- styles?.variations?.[
808
- styleVariationName
809
- ]
817
+ styleVariations
810
818
  );
811
819
 
812
820
  Object.entries( featureDeclarations ).forEach(
813
821
  ( [ baseSelector, declarations ] ) => {
814
- if ( !! declarations.length ) {
822
+ if ( declarations.length ) {
815
823
  const cssSelector =
816
824
  concatFeatureVariationSelectorString(
817
825
  baseSelector,
@@ -819,9 +827,7 @@ export const toStyles = (
819
827
  );
820
828
  const rules =
821
829
  declarations.join( ';' );
822
- ruleset =
823
- ruleset +
824
- `${ cssSelector }{${ rules }}`;
830
+ ruleset += `${ cssSelector }{${ rules };}`;
825
831
  }
826
832
  }
827
833
  );
@@ -830,39 +836,34 @@ export const toStyles = (
830
836
  // Otherwise add regular selectors.
831
837
  const styleVariationDeclarations =
832
838
  getStylesDeclarations(
833
- styles?.variations?.[ styleVariationName ],
839
+ styleVariations,
834
840
  styleVariationSelector,
835
841
  useRootPaddingAlign,
836
842
  tree
837
843
  );
838
- if ( !! styleVariationDeclarations.length ) {
839
- ruleset =
840
- ruleset +
841
- `${ styleVariationSelector }{${ styleVariationDeclarations.join(
842
- ';'
843
- ) }}`;
844
+ if ( styleVariationDeclarations.length ) {
845
+ ruleset += `${ styleVariationSelector }{${ styleVariationDeclarations.join(
846
+ ';'
847
+ ) };}`;
844
848
  }
845
849
  }
846
850
  }
847
851
  );
848
852
  }
849
853
 
850
- const duotoneStyles = {};
851
- if ( styles?.filter ) {
852
- duotoneStyles.filter = styles.filter;
853
- delete styles.filter;
854
- }
855
-
856
854
  // Process duotone styles.
857
855
  if ( duotoneSelector ) {
856
+ const duotoneStyles = {};
857
+ if ( styles?.filter ) {
858
+ duotoneStyles.filter = styles.filter;
859
+ delete styles.filter;
860
+ }
858
861
  const duotoneDeclarations =
859
862
  getStylesDeclarations( duotoneStyles );
860
- if ( duotoneDeclarations.length > 0 ) {
861
- ruleset =
862
- ruleset +
863
- `${ duotoneSelector }{${ duotoneDeclarations.join(
864
- ';'
865
- ) };}`;
863
+ if ( duotoneDeclarations.length ) {
864
+ ruleset += `${ duotoneSelector }{${ duotoneDeclarations.join(
865
+ ';'
866
+ ) };}`;
866
867
  }
867
868
  }
868
869
 
@@ -889,8 +890,7 @@ export const toStyles = (
889
890
  tree
890
891
  );
891
892
  if ( declarations?.length ) {
892
- ruleset =
893
- ruleset + `${ selector }{${ declarations.join( ';' ) };}`;
893
+ ruleset += `${ selector }{${ declarations.join( ';' ) };}`;
894
894
  }
895
895
 
896
896
  // Check for pseudo selector in `styles` and handle separately.
@@ -924,7 +924,7 @@ export const toStyles = (
924
924
  ';'
925
925
  ) };}`;
926
926
 
927
- ruleset = ruleset + pseudoRule;
927
+ ruleset += pseudoRule;
928
928
  }
929
929
  );
930
930
  }
@@ -965,7 +965,7 @@ export const toStyles = (
965
965
 
966
966
  const classes = getPresetsClasses( selector, presets );
967
967
  if ( ! isEmpty( classes ) ) {
968
- ruleset = ruleset + classes;
968
+ ruleset += classes;
969
969
  }
970
970
  } );
971
971
 
@@ -1106,9 +1106,17 @@ const processCSSNesting = ( css, blockSelector ) => {
1106
1106
  return processedCSS;
1107
1107
  };
1108
1108
 
1109
- export function useGlobalStylesOutput() {
1110
- let { merged: mergedConfig } = useContext( GlobalStylesContext );
1111
-
1109
+ /**
1110
+ * Returns the global styles output using a global styles configuration.
1111
+ * If wishing to generate global styles and settings based on the
1112
+ * global styles config loaded in the editor context, use `useGlobalStylesOutput()`.
1113
+ * The use case for a custom config is to generate bespoke styles
1114
+ * and settings for previews, or other out-of-editor experiences.
1115
+ *
1116
+ * @param {Object} mergedConfig Global styles configuration.
1117
+ * @return {Array} Array of stylesheets and settings.
1118
+ */
1119
+ export function useGlobalStylesOutputWithConfig( mergedConfig = {} ) {
1112
1120
  const [ blockGap ] = useGlobalSetting( 'spacing.blockGap' );
1113
1121
  const hasBlockGapSupport = blockGap !== null;
1114
1122
  const hasFallbackGapSupport = ! hasBlockGapSupport; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback styles support.
@@ -1190,3 +1198,13 @@ export function useGlobalStylesOutput() {
1190
1198
  disableLayoutStyles,
1191
1199
  ] );
1192
1200
  }
1201
+
1202
+ /**
1203
+ * Returns the global styles output based on the current state of global styles config loaded in the editor context.
1204
+ *
1205
+ * @return {Array} Array of stylesheets and settings.
1206
+ */
1207
+ export function useGlobalStylesOutput() {
1208
+ const { merged: mergedConfig } = useContext( GlobalStylesContext );
1209
+ return useGlobalStylesOutputWithConfig( mergedConfig );
1210
+ }
@@ -2,6 +2,7 @@
2
2
  * External dependencies
3
3
  */
4
4
  import { get } from 'lodash';
5
+ import fastDeepEqual from 'fast-deep-equal/es6';
5
6
 
6
7
  /**
7
8
  * Internal dependencies
@@ -376,3 +377,29 @@ export function scopeSelector( scope, selector ) {
376
377
 
377
378
  return selectorsScoped.join( ', ' );
378
379
  }
380
+
381
+ /**
382
+ * Compares global style variations according to their styles and settings properties.
383
+ *
384
+ * @example
385
+ * ```js
386
+ * const globalStyles = { styles: { typography: { fontSize: '10px' } }, settings: {} };
387
+ * const variation = { styles: { typography: { fontSize: '10000px' } }, settings: {} };
388
+ * const isEqual = areGlobalStyleConfigsEqual( globalStyles, variation );
389
+ * // false
390
+ * ```
391
+ *
392
+ * @param {Object} original A global styles object.
393
+ * @param {Object} variation A global styles object.
394
+ *
395
+ * @return {boolean} Whether `original` and `variation` match.
396
+ */
397
+ export function areGlobalStyleConfigsEqual( original, variation ) {
398
+ if ( typeof original !== 'object' || typeof variation !== 'object' ) {
399
+ return original === variation;
400
+ }
401
+ return (
402
+ fastDeepEqual( original?.styles, variation?.styles ) &&
403
+ fastDeepEqual( original?.settings, variation?.settings )
404
+ );
405
+ }
@@ -32,24 +32,35 @@ export default function useSaveImage( {
32
32
  const apply = useCallback( () => {
33
33
  setIsInProgress( true );
34
34
 
35
- let attrs = {};
35
+ const modifiers = [];
36
+
37
+ if ( rotation > 0 ) {
38
+ modifiers.push( {
39
+ type: 'rotate',
40
+ args: {
41
+ angle: rotation,
42
+ },
43
+ } );
44
+ }
36
45
 
37
46
  // The crop script may return some very small, sub-pixel values when the image was not cropped.
38
47
  // Crop only when the new size has changed by more than 0.1%.
39
48
  if ( crop.width < 99.9 || crop.height < 99.9 ) {
40
- attrs = crop;
41
- }
42
-
43
- if ( rotation > 0 ) {
44
- attrs.rotation = rotation;
49
+ modifiers.push( {
50
+ type: 'crop',
51
+ args: {
52
+ left: crop.x,
53
+ top: crop.y,
54
+ width: crop.width,
55
+ height: crop.height,
56
+ },
57
+ } );
45
58
  }
46
59
 
47
- attrs.src = url;
48
-
49
60
  apiFetch( {
50
61
  path: `/wp/v2/media/${ id }/edit`,
51
62
  method: 'POST',
52
- data: attrs,
63
+ data: { src: url, modifiers },
53
64
  } )
54
65
  .then( ( response ) => {
55
66
  onSaveImage( {
@@ -95,6 +95,7 @@ export { default as __experimentalSpacingSizesControl } from './spacing-sizes-co
95
95
  export {
96
96
  getSpacingPresetCssVar,
97
97
  isValueSpacingPreset,
98
+ getCustomValueFromPreset,
98
99
  } from './spacing-sizes-control/utils';
99
100
  /*
100
101
  * Content Related Components
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { groupBy } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -59,7 +54,15 @@ export function BlockTypesTab( {
59
54
  itemList.filter(
60
55
  ( item ) => item.category && item.category !== 'reusable'
61
56
  ),
62
- ( itemList ) => groupBy( itemList, 'category' )
57
+ ( itemList ) =>
58
+ itemList.reduce( ( acc, item ) => {
59
+ const { category } = item;
60
+ if ( ! acc[ category ] ) {
61
+ acc[ category ] = [];
62
+ }
63
+ acc[ category ].push( item );
64
+ return acc;
65
+ }, {} )
63
66
  )( items );
64
67
  }, [ items ] );
65
68
 
@@ -214,7 +214,7 @@ class PrivateInserter extends Component {
214
214
  'block-editor-inserter__popover',
215
215
  { 'is-quick': isQuick }
216
216
  ) }
217
- popoverProps={ { position } }
217
+ popoverProps={ { position, shift: true } }
218
218
  onToggle={ this.onToggle }
219
219
  expandOnMobile
220
220
  headerTitle={ __( 'Add a block' ) }
@@ -2,6 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { Draggable } from '@wordpress/components';
5
+ import { serialize } from '@wordpress/blocks';
5
6
  /**
6
7
  * Internal dependencies
7
8
  */
@@ -23,6 +24,9 @@ const InserterDraggableBlocks = ( {
23
24
  <Draggable
24
25
  __experimentalTransferDataType="wp-blocks"
25
26
  transferData={ transferData }
27
+ onDragStart={ ( event ) => {
28
+ event.dataTransfer.setData( 'text/html', serialize( blocks ) );
29
+ } }
26
30
  __experimentalDragComponent={
27
31
  <BlockDraggableChip
28
32
  count={ blocks.length }
@@ -41,7 +41,7 @@ export default function InspectorControlsFill( {
41
41
  const isDisplayed = useDisplayBlockControls();
42
42
  const Fill = groups[ group ]?.Fill;
43
43
  if ( ! Fill ) {
44
- warning( `Unknown InspectorControl group "${ group }" provided.` );
44
+ warning( `Unknown InspectorControls group "${ group }" provided.` );
45
45
  return null;
46
46
  }
47
47
  if ( ! isDisplayed ) {
@@ -39,7 +39,7 @@ export default function InspectorControlsFill( {
39
39
 
40
40
  const Fill = groups[ group ]?.Fill;
41
41
  if ( ! Fill ) {
42
- warning( `Unknown InspectorControl group "${ group }" provided.` );
42
+ warning( `Unknown InspectorControls group "${ group }" provided.` );
43
43
  return null;
44
44
  }
45
45
  if ( ! isDisplayed ) {
@@ -7,6 +7,7 @@ const InspectorControlsDefault = createSlotFill( 'InspectorControls' );
7
7
  const InspectorControlsAdvanced = createSlotFill( 'InspectorAdvancedControls' );
8
8
  const InspectorControlsBorder = createSlotFill( 'InspectorControlsBorder' );
9
9
  const InspectorControlsColor = createSlotFill( 'InspectorControlsColor' );
10
+ const InspectorControlsFilter = createSlotFill( 'InspectorControlsFilter' );
10
11
  const InspectorControlsDimensions = createSlotFill(
11
12
  'InspectorControlsDimensions'
12
13
  );
@@ -22,6 +23,7 @@ const groups = {
22
23
  advanced: InspectorControlsAdvanced,
23
24
  border: InspectorControlsBorder,
24
25
  color: InspectorControlsColor,
26
+ filter: InspectorControlsFilter,
25
27
  dimensions: InspectorControlsDimensions,
26
28
  list: InspectorControlsListView,
27
29
  settings: InspectorControlsDefault, // Alias for default.
@@ -1,10 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import {
5
- __experimentalUseSlot as useSlot,
6
- __experimentalUseSlotFills as useSlotFills,
7
- } from '@wordpress/components';
4
+ import { __experimentalUseSlotFills as useSlotFills } from '@wordpress/components';
8
5
  import warning from '@wordpress/warning';
9
6
  import deprecated from '@wordpress/deprecated';
10
7
 
@@ -33,15 +30,13 @@ export default function InspectorControlsSlot( {
33
30
  group = __experimentalGroup;
34
31
  }
35
32
  const Slot = groups[ group ]?.Slot;
36
- const slot = useSlot( Slot?.__unstableName );
37
33
  const fills = useSlotFills( Slot?.__unstableName );
38
- if ( ! Slot || ! slot ) {
39
- warning( `Unknown InspectorControl group "${ group }" provided.` );
34
+ if ( ! Slot ) {
35
+ warning( `Unknown InspectorControls group "${ group }" provided.` );
40
36
  return null;
41
37
  }
42
38
 
43
- const hasFills = Boolean( fills && fills.length );
44
- if ( ! hasFills ) {
39
+ if ( ! fills?.length ) {
45
40
  return null;
46
41
  }
47
42
 
@@ -27,7 +27,7 @@ export default function InspectorControlsSlot( {
27
27
  }
28
28
  const Slot = groups[ group ]?.Slot;
29
29
  if ( ! Slot ) {
30
- warning( `Unknown InspectorControl group "${ group }" provided.` );
30
+ warning( `Unknown InspectorControls group "${ group }" provided.` );
31
31
  return null;
32
32
  }
33
33
 
@@ -32,6 +32,7 @@ const StylesTab = ( { blockName, clientId, hasBlockStyles } ) => {
32
32
  label={ __( 'Color' ) }
33
33
  className="color-block-support-panel__inner-wrapper"
34
34
  />
35
+ <InspectorControls.Slot group="filter" />
35
36
  <InspectorControls.Slot
36
37
  group="typography"
37
38
  label={ __( 'Typography' ) }
@@ -85,12 +85,17 @@ const LineHeightControl = ( {
85
85
  : { marginBottom: 24 };
86
86
 
87
87
  const handleOnChange = ( nextValue, { event } ) => {
88
+ if ( nextValue === '' ) {
89
+ onChange();
90
+ return;
91
+ }
92
+
88
93
  if ( event.type === 'click' ) {
89
- onChange( adjustNextValue( nextValue, false ) );
94
+ onChange( adjustNextValue( `${ nextValue }`, false ) );
90
95
  return;
91
96
  }
92
97
 
93
- onChange( nextValue );
98
+ onChange( `${ nextValue }` );
94
99
  };
95
100
 
96
101
  return (
@@ -23,7 +23,7 @@ const Template = ( props ) => {
23
23
  export const Default = Template.bind( {} );
24
24
  Default.args = {
25
25
  __nextHasNoMarginBottom: true,
26
- __unstableInputWidth: '60px',
26
+ __unstableInputWidth: '100px',
27
27
  };
28
28
 
29
29
  export const UnconstrainedWidth = Template.bind( {} );