@wordpress/block-editor 12.16.0 → 12.16.1-next.79a6196f.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 (650) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +3 -6
  3. package/build/components/block-canvas/index.js +0 -2
  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-draggable/draggable-chip.js +6 -1
  8. package/build/components/block-draggable/draggable-chip.js.map +1 -1
  9. package/build/components/block-draggable/index.js +76 -6
  10. package/build/components/block-draggable/index.js.map +1 -1
  11. package/build/components/block-draggable/index.native.js +0 -6
  12. package/build/components/block-draggable/index.native.js.map +1 -1
  13. package/build/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
  14. package/build/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -1
  15. package/build/components/block-editing-mode/index.js +2 -3
  16. package/build/components/block-editing-mode/index.js.map +1 -1
  17. package/build/components/block-inspector/index.js +1 -1
  18. package/build/components/block-inspector/index.js.map +1 -1
  19. package/build/components/block-list/block-list-item-cell.native.js +1 -0
  20. package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
  21. package/build/components/block-list/block.js +245 -102
  22. package/build/components/block-list/block.js.map +1 -1
  23. package/build/components/block-list/block.native.js +46 -20
  24. package/build/components/block-list/block.native.js.map +1 -1
  25. package/build/components/block-list/index.native.js +3 -5
  26. package/build/components/block-list/index.native.js.map +1 -1
  27. package/build/components/block-list/private-block-context.js +14 -0
  28. package/build/components/block-list/private-block-context.js.map +1 -0
  29. package/build/components/block-list/use-block-props/index.js +33 -96
  30. package/build/components/block-list/use-block-props/index.js.map +1 -1
  31. package/build/components/block-list/use-in-between-inserter.js +3 -2
  32. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  33. package/build/components/block-list/use-scroll-upon-insertion.native.js +41 -0
  34. package/build/components/block-list/use-scroll-upon-insertion.native.js.map +1 -0
  35. package/build/components/block-lock/toolbar.js +21 -27
  36. package/build/components/block-lock/toolbar.js.map +1 -1
  37. package/build/components/block-mover/index.js +2 -1
  38. package/build/components/block-mover/index.js.map +1 -1
  39. package/build/components/block-patterns-list/index.js +4 -4
  40. package/build/components/block-patterns-list/index.js.map +1 -1
  41. package/build/components/block-switcher/index.js +4 -4
  42. package/build/components/block-switcher/index.js.map +1 -1
  43. package/build/components/block-toolbar/index.js +1 -2
  44. package/build/components/block-toolbar/index.js.map +1 -1
  45. package/build/components/block-tools/block-toolbar-popover.js +0 -2
  46. package/build/components/block-tools/block-toolbar-popover.js.map +1 -1
  47. package/build/components/block-variation-transforms/index.js +29 -2
  48. package/build/components/block-variation-transforms/index.js.map +1 -1
  49. package/build/components/border-radius-control/linked-button.js +1 -1
  50. package/build/components/border-radius-control/linked-button.js.map +1 -1
  51. package/build/components/colors/utils.js +10 -2
  52. package/build/components/colors/utils.js.map +1 -1
  53. package/build/components/colors/with-colors.js +6 -2
  54. package/build/components/colors/with-colors.js.map +1 -1
  55. package/build/components/font-sizes/utils.js +10 -2
  56. package/build/components/font-sizes/utils.js.map +1 -1
  57. package/build/components/global-styles/border-panel.js +2 -1
  58. package/build/components/global-styles/border-panel.js.map +1 -1
  59. package/build/components/global-styles/color-panel.js +2 -1
  60. package/build/components/global-styles/color-panel.js.map +1 -1
  61. package/build/components/global-styles/dimensions-panel.js +4 -3
  62. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  63. package/build/components/global-styles/effects-panel.js +2 -1
  64. package/build/components/global-styles/effects-panel.js.map +1 -1
  65. package/build/components/global-styles/filters-panel.js +1 -4
  66. package/build/components/global-styles/filters-panel.js.map +1 -1
  67. package/build/components/global-styles/get-global-styles-changes.js +192 -0
  68. package/build/components/global-styles/get-global-styles-changes.js.map +1 -0
  69. package/build/components/global-styles/hooks.js +3 -2
  70. package/build/components/global-styles/hooks.js.map +1 -1
  71. package/build/components/global-styles/image-settings-panel.js +7 -1
  72. package/build/components/global-styles/image-settings-panel.js.map +1 -1
  73. package/build/components/global-styles/index.js +7 -0
  74. package/build/components/global-styles/index.js.map +1 -1
  75. package/build/components/global-styles/typography-panel.js +33 -15
  76. package/build/components/global-styles/typography-panel.js.map +1 -1
  77. package/build/components/global-styles/use-global-styles-output.js +22 -8
  78. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  79. package/build/components/global-styles/utils.js +8 -1
  80. package/build/components/global-styles/utils.js.map +1 -1
  81. package/build/components/height-control/index.js +6 -2
  82. package/build/components/height-control/index.js.map +1 -1
  83. package/build/components/image-size-control/index.js +2 -2
  84. package/build/components/image-size-control/index.js.map +1 -1
  85. package/build/components/index.native.js +6 -5
  86. package/build/components/index.native.js.map +1 -1
  87. package/build/components/inner-blocks/index.js +61 -22
  88. package/build/components/inner-blocks/index.js.map +1 -1
  89. package/build/components/inner-blocks/index.native.js +18 -4
  90. package/build/components/inner-blocks/index.native.js.map +1 -1
  91. package/build/components/inner-blocks/use-inner-block-template-sync.js +5 -6
  92. package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  93. package/build/components/inner-blocks/use-nested-settings-update.js +5 -9
  94. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  95. package/build/components/inserter/block-patterns-explorer/pattern-list.js +1 -1
  96. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  97. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +10 -9
  98. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  99. package/build/components/inserter/block-patterns-tab/patterns-filter.js +10 -10
  100. package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  101. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +9 -9
  102. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  103. package/build/components/inserter/block-patterns-tab/utils.js +10 -14
  104. package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
  105. package/build/components/inserter/hooks/use-block-types-state.js +4 -14
  106. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  107. package/build/components/inserter/hooks/use-patterns-state.js +1 -1
  108. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  109. package/build/components/inserter/index.js +1 -2
  110. package/build/components/inserter/index.js.map +1 -1
  111. package/build/components/inserter/library.js +3 -7
  112. package/build/components/inserter/library.js.map +1 -1
  113. package/build/components/inserter/menu.js +14 -28
  114. package/build/components/inserter/menu.js.map +1 -1
  115. package/build/components/inserter/tabs.js +21 -21
  116. package/build/components/inserter/tabs.js.map +1 -1
  117. package/build/components/inserter-draggable-blocks/index.js +1 -1
  118. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  119. package/build/components/inserter-list-item/index.js +2 -4
  120. package/build/components/inserter-list-item/index.js.map +1 -1
  121. package/build/components/inspector-controls/block-support-tools-panel.js +3 -1
  122. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  123. package/build/components/inspector-controls-tabs/index.js +34 -23
  124. package/build/components/inspector-controls-tabs/index.js.map +1 -1
  125. package/build/components/list-view/block-select-button.js +4 -0
  126. package/build/components/list-view/block-select-button.js.map +1 -1
  127. package/build/components/list-view/block.js +57 -3
  128. package/build/components/list-view/block.js.map +1 -1
  129. package/build/components/media-upload-progress/constants.js +19 -0
  130. package/build/components/media-upload-progress/constants.js.map +1 -0
  131. package/build/components/media-upload-progress/index.native.js +42 -17
  132. package/build/components/media-upload-progress/index.native.js.map +1 -1
  133. package/build/components/navigable-toolbar/index.js +9 -14
  134. package/build/components/navigable-toolbar/index.js.map +1 -1
  135. package/build/components/plain-text/index.native.js +8 -3
  136. package/build/components/plain-text/index.native.js.map +1 -1
  137. package/build/components/provider/index.js +3 -1
  138. package/build/components/provider/index.js.map +1 -1
  139. package/build/components/provider/use-block-sync.js +7 -1
  140. package/build/components/provider/use-block-sync.js.map +1 -1
  141. package/build/components/rich-text/index.js +17 -7
  142. package/build/components/rich-text/index.js.map +1 -1
  143. package/build/components/rich-text/native/index.native.js +16 -24
  144. package/build/components/rich-text/native/index.native.js.map +1 -1
  145. package/build/components/rich-text/use-input-rules.js +2 -2
  146. package/build/components/rich-text/use-input-rules.js.map +1 -1
  147. package/build/components/rich-text/use-mark-persistent.js +1 -1
  148. package/build/components/rich-text/use-mark-persistent.js.map +1 -1
  149. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
  150. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  151. package/build/components/url-input/index.js +9 -6
  152. package/build/components/url-input/index.js.map +1 -1
  153. package/build/components/use-block-commands/index.js +14 -18
  154. package/build/components/use-block-commands/index.js.map +1 -1
  155. package/build/components/use-block-drop-zone/index.js +51 -22
  156. package/build/components/use-block-drop-zone/index.js.map +1 -1
  157. package/build/components/use-moving-animation/index.js +100 -92
  158. package/build/components/use-moving-animation/index.js.map +1 -1
  159. package/build/components/use-on-block-drop/index.js +8 -11
  160. package/build/components/use-on-block-drop/index.js.map +1 -1
  161. package/build/components/writing-flow/index.js +0 -1
  162. package/build/components/writing-flow/index.js.map +1 -1
  163. package/build/components/writing-flow/use-drag-selection.js +15 -4
  164. package/build/components/writing-flow/use-drag-selection.js.map +1 -1
  165. package/build/components/writing-flow/use-selection-observer.js +73 -27
  166. package/build/components/writing-flow/use-selection-observer.js.map +1 -1
  167. package/build/components/writing-flow/use-tab-nav.js +7 -4
  168. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  169. package/build/hooks/align.js +1 -1
  170. package/build/hooks/align.js.map +1 -1
  171. package/build/hooks/anchor.js +1 -1
  172. package/build/hooks/anchor.js.map +1 -1
  173. package/build/hooks/aria-label.js +9 -1
  174. package/build/hooks/aria-label.js.map +1 -1
  175. package/build/hooks/background.js +185 -20
  176. package/build/hooks/background.js.map +1 -1
  177. package/build/hooks/border.js +5 -10
  178. package/build/hooks/border.js.map +1 -1
  179. package/build/hooks/color.js +13 -11
  180. package/build/hooks/color.js.map +1 -1
  181. package/build/hooks/custom-class-name.js +1 -1
  182. package/build/hooks/custom-class-name.js.map +1 -1
  183. package/build/hooks/custom-class-name.native.js +9 -1
  184. package/build/hooks/custom-class-name.native.js.map +1 -1
  185. package/build/hooks/dimensions.js +4 -9
  186. package/build/hooks/dimensions.js.map +1 -1
  187. package/build/hooks/font-family.js +7 -3
  188. package/build/hooks/font-family.js.map +1 -1
  189. package/build/hooks/font-size.js +1 -1
  190. package/build/hooks/font-size.js.map +1 -1
  191. package/build/hooks/index.js +4 -4
  192. package/build/hooks/index.js.map +1 -1
  193. package/build/hooks/index.native.js +5 -3
  194. package/build/hooks/index.native.js.map +1 -1
  195. package/build/hooks/layout.js +10 -4
  196. package/build/hooks/layout.js.map +1 -1
  197. package/build/hooks/style.js +1 -1
  198. package/build/hooks/style.js.map +1 -1
  199. package/build/hooks/typography.js +4 -9
  200. package/build/hooks/typography.js.map +1 -1
  201. package/build/hooks/typography.native.js +43 -18
  202. package/build/hooks/typography.native.js.map +1 -1
  203. package/build/hooks/use-typography-props.js +10 -2
  204. package/build/hooks/use-typography-props.js.map +1 -1
  205. package/build/hooks/utils.js +48 -5
  206. package/build/hooks/utils.js.map +1 -1
  207. package/build/private-apis.js +2 -4
  208. package/build/private-apis.js.map +1 -1
  209. package/build/private-apis.native.js +0 -2
  210. package/build/private-apis.native.js.map +1 -1
  211. package/build/store/actions.js +0 -16
  212. package/build/store/actions.js.map +1 -1
  213. package/build/store/private-actions.js +51 -5
  214. package/build/store/private-actions.js.map +1 -1
  215. package/build/store/private-selectors.js +12 -0
  216. package/build/store/private-selectors.js.map +1 -1
  217. package/build/store/reducer.js +14 -6
  218. package/build/store/reducer.js.map +1 -1
  219. package/build/store/selectors.js +1 -13
  220. package/build/store/selectors.js.map +1 -1
  221. package/build/store/undo-ignore.js +12 -0
  222. package/build/store/undo-ignore.js.map +1 -0
  223. package/build/store/utils.js +1 -1
  224. package/build/store/utils.js.map +1 -1
  225. package/build/utils/get-px-from-css-unit.js +16 -0
  226. package/build/utils/get-px-from-css-unit.js.map +1 -0
  227. package/build/utils/index.js +2 -2
  228. package/build/utils/index.js.map +1 -1
  229. package/build/utils/object.js +17 -38
  230. package/build/utils/object.js.map +1 -1
  231. package/build/utils/use-can-block-toolbar-be-focused.js +46 -0
  232. package/build/utils/use-can-block-toolbar-be-focused.js.map +1 -0
  233. package/build-module/components/block-canvas/index.js +0 -2
  234. package/build-module/components/block-canvas/index.js.map +1 -1
  235. package/build-module/components/block-card/index.js +1 -1
  236. package/build-module/components/block-card/index.js.map +1 -1
  237. package/build-module/components/block-draggable/draggable-chip.js +6 -1
  238. package/build-module/components/block-draggable/draggable-chip.js.map +1 -1
  239. package/build-module/components/block-draggable/index.js +76 -6
  240. package/build-module/components/block-draggable/index.js.map +1 -1
  241. package/build-module/components/block-draggable/index.native.js +1 -7
  242. package/build-module/components/block-draggable/index.native.js.map +1 -1
  243. package/build-module/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
  244. package/build-module/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -1
  245. package/build-module/components/block-editing-mode/index.js +3 -4
  246. package/build-module/components/block-editing-mode/index.js.map +1 -1
  247. package/build-module/components/block-inspector/index.js +1 -1
  248. package/build-module/components/block-inspector/index.js.map +1 -1
  249. package/build-module/components/block-list/block-list-item-cell.native.js +1 -0
  250. package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -1
  251. package/build-module/components/block-list/block.js +249 -106
  252. package/build-module/components/block-list/block.js.map +1 -1
  253. package/build-module/components/block-list/block.native.js +48 -22
  254. package/build-module/components/block-list/block.native.js.map +1 -1
  255. package/build-module/components/block-list/index.native.js +3 -5
  256. package/build-module/components/block-list/index.native.js.map +1 -1
  257. package/build-module/components/block-list/private-block-context.js +6 -0
  258. package/build-module/components/block-list/private-block-context.js.map +1 -0
  259. package/build-module/components/block-list/use-block-props/index.js +34 -97
  260. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  261. package/build-module/components/block-list/use-in-between-inserter.js +3 -2
  262. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  263. package/build-module/components/block-list/use-scroll-upon-insertion.native.js +33 -0
  264. package/build-module/components/block-list/use-scroll-upon-insertion.native.js.map +1 -0
  265. package/build-module/components/block-lock/toolbar.js +22 -28
  266. package/build-module/components/block-lock/toolbar.js.map +1 -1
  267. package/build-module/components/block-mover/index.js +2 -1
  268. package/build-module/components/block-mover/index.js.map +1 -1
  269. package/build-module/components/block-patterns-list/index.js +5 -5
  270. package/build-module/components/block-patterns-list/index.js.map +1 -1
  271. package/build-module/components/block-switcher/index.js +4 -4
  272. package/build-module/components/block-switcher/index.js.map +1 -1
  273. package/build-module/components/block-toolbar/index.js +1 -2
  274. package/build-module/components/block-toolbar/index.js.map +1 -1
  275. package/build-module/components/block-tools/block-toolbar-popover.js +0 -2
  276. package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -1
  277. package/build-module/components/block-variation-transforms/index.js +30 -3
  278. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  279. package/build-module/components/border-radius-control/linked-button.js +1 -1
  280. package/build-module/components/border-radius-control/linked-button.js.map +1 -1
  281. package/build-module/components/colors/utils.js +9 -1
  282. package/build-module/components/colors/utils.js.map +1 -1
  283. package/build-module/components/colors/with-colors.js +5 -1
  284. package/build-module/components/colors/with-colors.js.map +1 -1
  285. package/build-module/components/font-sizes/utils.js +9 -1
  286. package/build-module/components/font-sizes/utils.js.map +1 -1
  287. package/build-module/components/global-styles/border-panel.js +3 -2
  288. package/build-module/components/global-styles/border-panel.js.map +1 -1
  289. package/build-module/components/global-styles/color-panel.js +3 -2
  290. package/build-module/components/global-styles/color-panel.js.map +1 -1
  291. package/build-module/components/global-styles/dimensions-panel.js +5 -4
  292. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  293. package/build-module/components/global-styles/effects-panel.js +3 -2
  294. package/build-module/components/global-styles/effects-panel.js.map +1 -1
  295. package/build-module/components/global-styles/filters-panel.js +2 -5
  296. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  297. package/build-module/components/global-styles/get-global-styles-changes.js +184 -0
  298. package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -0
  299. package/build-module/components/global-styles/hooks.js +3 -2
  300. package/build-module/components/global-styles/hooks.js.map +1 -1
  301. package/build-module/components/global-styles/image-settings-panel.js +7 -1
  302. package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
  303. package/build-module/components/global-styles/index.js +1 -0
  304. package/build-module/components/global-styles/index.js.map +1 -1
  305. package/build-module/components/global-styles/typography-panel.js +35 -17
  306. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  307. package/build-module/components/global-styles/use-global-styles-output.js +15 -1
  308. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  309. package/build-module/components/global-styles/utils.js +7 -0
  310. package/build-module/components/global-styles/utils.js.map +1 -1
  311. package/build-module/components/height-control/index.js +6 -2
  312. package/build-module/components/height-control/index.js.map +1 -1
  313. package/build-module/components/image-size-control/index.js +2 -2
  314. package/build-module/components/image-size-control/index.js.map +1 -1
  315. package/build-module/components/index.native.js +2 -1
  316. package/build-module/components/index.native.js.map +1 -1
  317. package/build-module/components/inner-blocks/index.js +62 -23
  318. package/build-module/components/inner-blocks/index.js.map +1 -1
  319. package/build-module/components/inner-blocks/index.native.js +18 -4
  320. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  321. package/build-module/components/inner-blocks/use-inner-block-template-sync.js +5 -6
  322. package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  323. package/build-module/components/inner-blocks/use-nested-settings-update.js +6 -10
  324. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  325. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  326. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  327. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +11 -10
  328. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  329. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +11 -11
  330. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  331. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +11 -11
  332. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  333. package/build-module/components/inserter/block-patterns-tab/utils.js +7 -11
  334. package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
  335. package/build-module/components/inserter/hooks/use-block-types-state.js +4 -14
  336. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  337. package/build-module/components/inserter/hooks/use-patterns-state.js +2 -2
  338. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  339. package/build-module/components/inserter/index.js +1 -2
  340. package/build-module/components/inserter/index.js.map +1 -1
  341. package/build-module/components/inserter/library.js +3 -7
  342. package/build-module/components/inserter/library.js.map +1 -1
  343. package/build-module/components/inserter/menu.js +14 -28
  344. package/build-module/components/inserter/menu.js.map +1 -1
  345. package/build-module/components/inserter/tabs.js +22 -22
  346. package/build-module/components/inserter/tabs.js.map +1 -1
  347. package/build-module/components/inserter-draggable-blocks/index.js +2 -2
  348. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  349. package/build-module/components/inserter-list-item/index.js +2 -4
  350. package/build-module/components/inserter-list-item/index.js.map +1 -1
  351. package/build-module/components/inspector-controls/block-support-tools-panel.js +3 -1
  352. package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  353. package/build-module/components/inspector-controls-tabs/index.js +35 -24
  354. package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
  355. package/build-module/components/list-view/block-select-button.js +4 -0
  356. package/build-module/components/list-view/block-select-button.js.map +1 -1
  357. package/build-module/components/list-view/block.js +58 -4
  358. package/build-module/components/list-view/block.js.map +1 -1
  359. package/build-module/components/media-upload-progress/constants.js +7 -0
  360. package/build-module/components/media-upload-progress/constants.js.map +1 -0
  361. package/build-module/components/media-upload-progress/index.native.js +37 -8
  362. package/build-module/components/media-upload-progress/index.native.js.map +1 -1
  363. package/build-module/components/navigable-toolbar/index.js +9 -14
  364. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  365. package/build-module/components/plain-text/index.native.js +6 -1
  366. package/build-module/components/plain-text/index.native.js.map +1 -1
  367. package/build-module/components/provider/index.js +3 -1
  368. package/build-module/components/provider/index.js.map +1 -1
  369. package/build-module/components/provider/use-block-sync.js +7 -1
  370. package/build-module/components/provider/use-block-sync.js.map +1 -1
  371. package/build-module/components/rich-text/index.js +17 -7
  372. package/build-module/components/rich-text/index.js.map +1 -1
  373. package/build-module/components/rich-text/native/index.native.js +16 -23
  374. package/build-module/components/rich-text/native/index.native.js.map +1 -1
  375. package/build-module/components/rich-text/use-input-rules.js +2 -2
  376. package/build-module/components/rich-text/use-input-rules.js.map +1 -1
  377. package/build-module/components/rich-text/use-mark-persistent.js +1 -1
  378. package/build-module/components/rich-text/use-mark-persistent.js.map +1 -1
  379. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
  380. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  381. package/build-module/components/url-input/index.js +9 -6
  382. package/build-module/components/url-input/index.js.map +1 -1
  383. package/build-module/components/use-block-commands/index.js +14 -18
  384. package/build-module/components/use-block-commands/index.js.map +1 -1
  385. package/build-module/components/use-block-drop-zone/index.js +51 -23
  386. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  387. package/build-module/components/use-moving-animation/index.js +102 -94
  388. package/build-module/components/use-moving-animation/index.js.map +1 -1
  389. package/build-module/components/use-on-block-drop/index.js +8 -11
  390. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  391. package/build-module/components/writing-flow/index.js +0 -1
  392. package/build-module/components/writing-flow/index.js.map +1 -1
  393. package/build-module/components/writing-flow/use-drag-selection.js +15 -4
  394. package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
  395. package/build-module/components/writing-flow/use-selection-observer.js +73 -27
  396. package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
  397. package/build-module/components/writing-flow/use-tab-nav.js +7 -4
  398. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  399. package/build-module/hooks/align.js +1 -1
  400. package/build-module/hooks/align.js.map +1 -1
  401. package/build-module/hooks/anchor.js +1 -1
  402. package/build-module/hooks/anchor.js.map +1 -1
  403. package/build-module/hooks/aria-label.js +7 -1
  404. package/build-module/hooks/aria-label.js.map +1 -1
  405. package/build-module/hooks/background.js +181 -19
  406. package/build-module/hooks/background.js.map +1 -1
  407. package/build-module/hooks/border.js +2 -8
  408. package/build-module/hooks/border.js.map +1 -1
  409. package/build-module/hooks/color.js +11 -9
  410. package/build-module/hooks/color.js.map +1 -1
  411. package/build-module/hooks/custom-class-name.js +1 -1
  412. package/build-module/hooks/custom-class-name.js.map +1 -1
  413. package/build-module/hooks/custom-class-name.native.js +7 -1
  414. package/build-module/hooks/custom-class-name.native.js.map +1 -1
  415. package/build-module/hooks/dimensions.js +1 -7
  416. package/build-module/hooks/dimensions.js.map +1 -1
  417. package/build-module/hooks/font-family.js +6 -2
  418. package/build-module/hooks/font-family.js.map +1 -1
  419. package/build-module/hooks/font-size.js +1 -1
  420. package/build-module/hooks/font-size.js.map +1 -1
  421. package/build-module/hooks/index.js +5 -5
  422. package/build-module/hooks/index.js.map +1 -1
  423. package/build-module/hooks/index.native.js +6 -4
  424. package/build-module/hooks/index.native.js.map +1 -1
  425. package/build-module/hooks/layout.js +9 -3
  426. package/build-module/hooks/layout.js.map +1 -1
  427. package/build-module/hooks/style.js +1 -1
  428. package/build-module/hooks/style.js.map +1 -1
  429. package/build-module/hooks/typography.js +1 -7
  430. package/build-module/hooks/typography.js.map +1 -1
  431. package/build-module/hooks/typography.native.js +43 -17
  432. package/build-module/hooks/typography.native.js.map +1 -1
  433. package/build-module/hooks/use-typography-props.js +9 -1
  434. package/build-module/hooks/use-typography-props.js.map +1 -1
  435. package/build-module/hooks/utils.js +47 -5
  436. package/build-module/hooks/utils.js.map +1 -1
  437. package/build-module/private-apis.js +2 -4
  438. package/build-module/private-apis.js.map +1 -1
  439. package/build-module/private-apis.native.js +0 -2
  440. package/build-module/private-apis.native.js.map +1 -1
  441. package/build-module/store/actions.js +0 -15
  442. package/build-module/store/actions.js.map +1 -1
  443. package/build-module/store/private-actions.js +49 -4
  444. package/build-module/store/private-actions.js.map +1 -1
  445. package/build-module/store/private-selectors.js +11 -0
  446. package/build-module/store/private-selectors.js.map +1 -1
  447. package/build-module/store/reducer.js +14 -6
  448. package/build-module/store/reducer.js.map +1 -1
  449. package/build-module/store/selectors.js +1 -12
  450. package/build-module/store/selectors.js.map +1 -1
  451. package/build-module/store/undo-ignore.js +5 -0
  452. package/build-module/store/undo-ignore.js.map +1 -0
  453. package/build-module/store/utils.js +2 -2
  454. package/build-module/store/utils.js.map +1 -1
  455. package/build-module/utils/get-px-from-css-unit.js +9 -0
  456. package/build-module/utils/get-px-from-css-unit.js.map +1 -0
  457. package/build-module/utils/index.js +1 -1
  458. package/build-module/utils/index.js.map +1 -1
  459. package/build-module/utils/object.js +16 -37
  460. package/build-module/utils/object.js.map +1 -1
  461. package/build-module/utils/use-can-block-toolbar-be-focused.js +40 -0
  462. package/build-module/utils/use-can-block-toolbar-be-focused.js.map +1 -0
  463. package/build-style/content-rtl.css +7 -6
  464. package/build-style/content.css +7 -6
  465. package/build-style/style-rtl.css +51 -8
  466. package/build-style/style.css +51 -8
  467. package/package.json +31 -31
  468. package/src/components/alignment-control/README.md +0 -5
  469. package/src/components/block-alignment-control/README.md +0 -5
  470. package/src/components/block-alignment-matrix-control/README.md +0 -10
  471. package/src/components/block-breadcrumb/README.md +0 -5
  472. package/src/components/block-canvas/index.js +0 -2
  473. package/src/components/block-canvas/style.scss +6 -0
  474. package/src/components/block-caption/README.md +0 -5
  475. package/src/components/block-card/README.md +0 -5
  476. package/src/components/block-card/index.js +1 -1
  477. package/src/components/block-draggable/draggable-chip.js +11 -1
  478. package/src/components/block-draggable/index.js +116 -4
  479. package/src/components/block-draggable/index.native.js +0 -5
  480. package/src/components/block-draggable/style.scss +35 -0
  481. package/src/components/block-draggable/test/helpers.native.js +8 -7
  482. package/src/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
  483. package/src/components/block-editing-mode/index.js +3 -3
  484. package/src/components/block-icon/README.md +0 -5
  485. package/src/components/block-inspector/README.md +0 -5
  486. package/src/components/block-inspector/index.js +3 -1
  487. package/src/components/block-list/block-list-item-cell.native.js +5 -1
  488. package/src/components/block-list/block.js +290 -119
  489. package/src/components/block-list/block.native.js +55 -21
  490. package/src/components/block-list/content.scss +14 -10
  491. package/src/components/block-list/index.native.js +3 -5
  492. package/src/components/block-list/{block-list-block-context.js → private-block-context.js} +1 -1
  493. package/src/components/block-list/use-block-props/index.js +32 -128
  494. package/src/components/block-list/use-in-between-inserter.js +4 -1
  495. package/src/components/block-list/use-scroll-upon-insertion.native.js +52 -0
  496. package/src/components/block-lock/toolbar.js +23 -34
  497. package/src/components/block-mover/README.md +0 -5
  498. package/src/components/block-mover/index.js +1 -1
  499. package/src/components/block-parent-selector/README.md +0 -5
  500. package/src/components/block-patterns-list/README.md +0 -5
  501. package/src/components/block-patterns-list/index.js +8 -5
  502. package/src/components/block-switcher/index.js +49 -59
  503. package/src/components/block-toolbar/README.md +0 -5
  504. package/src/components/block-toolbar/index.js +1 -2
  505. package/src/components/block-tools/block-toolbar-popover.js +4 -10
  506. package/src/components/block-types-list/README.md +0 -5
  507. package/src/components/block-variation-picker/README.md +0 -5
  508. package/src/components/block-variation-transforms/README.md +0 -5
  509. package/src/components/block-variation-transforms/index.js +49 -3
  510. package/src/components/border-radius-control/linked-button.js +1 -1
  511. package/src/components/caption/README.md +0 -5
  512. package/src/components/color-palette/test/__snapshots__/control.js.snap +0 -1
  513. package/src/components/colors/utils.js +8 -1
  514. package/src/components/colors/with-colors.js +3 -1
  515. package/src/components/contrast-checker/README.md +0 -4
  516. package/src/components/copy-handler/README.md +0 -10
  517. package/src/components/font-sizes/utils.js +7 -1
  518. package/src/components/global-styles/border-panel.js +2 -1
  519. package/src/components/global-styles/color-panel.js +2 -1
  520. package/src/components/global-styles/dimensions-panel.js +4 -3
  521. package/src/components/global-styles/effects-panel.js +2 -1
  522. package/src/components/global-styles/filters-panel.js +2 -5
  523. package/src/components/global-styles/get-global-styles-changes.js +210 -0
  524. package/src/components/global-styles/hooks.js +5 -0
  525. package/src/components/global-styles/image-settings-panel.js +6 -0
  526. package/src/components/global-styles/index.js +1 -0
  527. package/src/components/global-styles/test/get-global-styles-changes.js +234 -0
  528. package/src/components/global-styles/typography-panel.js +47 -14
  529. package/src/components/global-styles/use-global-styles-output.js +9 -5
  530. package/src/components/global-styles/utils.js +7 -0
  531. package/src/components/height-control/README.md +2 -7
  532. package/src/components/height-control/index.js +4 -0
  533. package/src/components/image-size-control/index.js +5 -2
  534. package/src/components/index.native.js +2 -2
  535. package/src/components/inner-blocks/index.js +68 -29
  536. package/src/components/inner-blocks/index.native.js +19 -7
  537. package/src/components/inner-blocks/use-inner-block-template-sync.js +5 -7
  538. package/src/components/inner-blocks/use-nested-settings-update.js +6 -13
  539. package/src/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  540. package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +15 -15
  541. package/src/components/inserter/block-patterns-tab/patterns-filter.js +15 -13
  542. package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +15 -18
  543. package/src/components/inserter/block-patterns-tab/utils.js +11 -12
  544. package/src/components/inserter/hooks/use-block-types-state.js +9 -11
  545. package/src/components/inserter/hooks/use-patterns-state.js +2 -2
  546. package/src/components/inserter/index.js +0 -1
  547. package/src/components/inserter/library.js +2 -8
  548. package/src/components/inserter/menu.js +13 -31
  549. package/src/components/inserter/style.scss +6 -4
  550. package/src/components/inserter/tabs.js +34 -25
  551. package/src/components/inserter-draggable-blocks/index.js +2 -2
  552. package/src/components/inserter-list-item/index.js +6 -6
  553. package/src/components/inspector-controls/block-support-tools-panel.js +2 -0
  554. package/src/components/inspector-controls-tabs/index.js +39 -28
  555. package/src/components/inspector-controls-tabs/style.scss +3 -2
  556. package/src/components/letter-spacing-control/README.md +0 -5
  557. package/src/components/line-height-control/README.md +0 -5
  558. package/src/components/list-view/README.md +0 -5
  559. package/src/components/list-view/block-select-button.js +4 -0
  560. package/src/components/list-view/block.js +73 -2
  561. package/src/components/list-view/style.scss +6 -0
  562. package/src/components/media-upload-progress/constants.js +6 -0
  563. package/src/components/media-upload-progress/index.native.js +66 -14
  564. package/src/components/media-upload-progress/test/index.native.js +2 -2
  565. package/src/components/multi-selection-inspector/README.md +0 -5
  566. package/src/components/navigable-toolbar/index.js +13 -11
  567. package/src/components/plain-text/index.native.js +6 -1
  568. package/src/components/provider/index.js +1 -1
  569. package/src/components/provider/test/use-block-sync.js +20 -17
  570. package/src/components/provider/use-block-sync.js +6 -0
  571. package/src/components/rich-text/index.js +18 -6
  572. package/src/components/rich-text/native/index.native.js +16 -24
  573. package/src/components/rich-text/native/test/__snapshots__/index.native.js.snap +3 -3
  574. package/src/components/rich-text/native/test/index.native.js +72 -5
  575. package/src/components/rich-text/use-input-rules.js +2 -2
  576. package/src/components/rich-text/use-mark-persistent.js +1 -2
  577. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
  578. package/src/components/text-decoration-control/README.md +40 -0
  579. package/src/components/text-transform-control/README.md +0 -4
  580. package/src/components/ungroup-button/README.md +0 -5
  581. package/src/components/unit-control/README.md +0 -4
  582. package/src/components/url-input/index.js +11 -11
  583. package/src/components/use-block-commands/index.js +18 -21
  584. package/src/components/use-block-drop-zone/index.js +85 -34
  585. package/src/components/use-moving-animation/index.js +107 -103
  586. package/src/components/use-on-block-drop/index.js +7 -23
  587. package/src/components/use-on-block-drop/test/index.js +12 -26
  588. package/src/components/use-resize-canvas/README.md +0 -4
  589. package/src/components/use-settings/README.md +0 -4
  590. package/src/components/writing-flow/index.js +0 -1
  591. package/src/components/writing-flow/use-drag-selection.js +18 -4
  592. package/src/components/writing-flow/use-selection-observer.js +99 -37
  593. package/src/components/writing-flow/use-tab-nav.js +7 -7
  594. package/src/hooks/align.js +1 -5
  595. package/src/hooks/anchor.js +1 -5
  596. package/src/hooks/aria-label.js +8 -5
  597. package/src/hooks/background.js +253 -21
  598. package/src/hooks/border.js +2 -13
  599. package/src/hooks/color.js +19 -14
  600. package/src/hooks/custom-class-name.js +1 -5
  601. package/src/hooks/custom-class-name.native.js +8 -5
  602. package/src/hooks/dimensions.js +1 -7
  603. package/src/hooks/font-family.js +4 -7
  604. package/src/hooks/font-size.js +1 -6
  605. package/src/hooks/index.js +19 -5
  606. package/src/hooks/index.native.js +17 -4
  607. package/src/hooks/layout.js +5 -2
  608. package/src/hooks/style.js +1 -6
  609. package/src/hooks/test/anchor.js +4 -9
  610. package/src/hooks/test/custom-class-name.js +3 -8
  611. package/src/hooks/test/style.js +4 -14
  612. package/src/hooks/typography.js +1 -7
  613. package/src/hooks/typography.native.js +31 -33
  614. package/src/hooks/use-typography-props.js +7 -1
  615. package/src/hooks/utils.js +76 -6
  616. package/src/private-apis.js +2 -4
  617. package/src/private-apis.native.js +0 -2
  618. package/src/store/actions.js +0 -15
  619. package/src/store/private-actions.js +44 -4
  620. package/src/store/private-selectors.js +11 -0
  621. package/src/store/reducer.js +16 -5
  622. package/src/store/selectors.js +5 -13
  623. package/src/store/undo-ignore.js +4 -0
  624. package/src/store/utils.js +2 -2
  625. package/src/style.scss +1 -0
  626. package/src/utils/get-px-from-css-unit.js +8 -0
  627. package/src/utils/index.js +1 -1
  628. package/src/utils/object.js +16 -35
  629. package/src/utils/test/object.js +1 -96
  630. package/src/utils/use-can-block-toolbar-be-focused.js +48 -0
  631. package/build/components/block-list/block-list-block-context.js +0 -14
  632. package/build/components/block-list/block-list-block-context.js.map +0 -1
  633. package/build/hooks/custom-fields.js +0 -106
  634. package/build/hooks/custom-fields.js.map +0 -1
  635. package/build/utils/parse-css-unit-to-px.js +0 -302
  636. package/build/utils/parse-css-unit-to-px.js.map +0 -1
  637. package/build/utils/use-should-contextual-toolbar-show.js +0 -63
  638. package/build/utils/use-should-contextual-toolbar-show.js.map +0 -1
  639. package/build-module/components/block-list/block-list-block-context.js +0 -6
  640. package/build-module/components/block-list/block-list-block-context.js.map +0 -1
  641. package/build-module/hooks/custom-fields.js +0 -99
  642. package/build-module/hooks/custom-fields.js.map +0 -1
  643. package/build-module/utils/parse-css-unit-to-px.js +0 -294
  644. package/build-module/utils/parse-css-unit-to-px.js.map +0 -1
  645. package/build-module/utils/use-should-contextual-toolbar-show.js +0 -57
  646. package/build-module/utils/use-should-contextual-toolbar-show.js.map +0 -1
  647. package/src/hooks/custom-fields.js +0 -115
  648. package/src/utils/parse-css-unit-to-px.js +0 -329
  649. package/src/utils/test/parse-css-unit-to-px.js +0 -172
  650. package/src/utils/use-should-contextual-toolbar-show.js +0 -85
@@ -0,0 +1,234 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import getGlobalStylesChanges from '../get-global-styles-changes';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import {
10
+ registerBlockType,
11
+ unregisterBlockType,
12
+ getBlockTypes,
13
+ } from '@wordpress/blocks';
14
+
15
+ describe( 'getGlobalStylesChanges', () => {
16
+ beforeEach( () => {
17
+ registerBlockType( 'core/test-fiori-di-zucca', {
18
+ save: () => {},
19
+ category: 'text',
20
+ title: 'Test pumpkin flowers',
21
+ edit: () => {},
22
+ } );
23
+ } );
24
+
25
+ afterEach( () => {
26
+ getBlockTypes().forEach( ( block ) => {
27
+ unregisterBlockType( block.name );
28
+ } );
29
+ } );
30
+
31
+ const revision = {
32
+ id: 10,
33
+ styles: {
34
+ typography: {
35
+ fontSize: 'var(--wp--preset--font-size--potato)',
36
+ fontStyle: 'normal',
37
+ fontWeight: '600',
38
+ lineHeight: '1.85',
39
+ fontFamily: 'var(--wp--preset--font-family--asparagus)',
40
+ },
41
+ spacing: {
42
+ padding: {
43
+ top: '36px',
44
+ right: '89px',
45
+ bottom: '133px',
46
+ left: 'var(--wp--preset--spacing--20)',
47
+ },
48
+ blockGap: '114px',
49
+ },
50
+ elements: {
51
+ heading: {
52
+ typography: {
53
+ letterSpacing: '37px',
54
+ },
55
+ },
56
+ h3: {
57
+ typography: {
58
+ lineHeight: '1.2',
59
+ },
60
+ },
61
+ caption: {
62
+ color: {
63
+ text: 'var(--wp--preset--color--pineapple)',
64
+ },
65
+ },
66
+ },
67
+ color: {
68
+ text: 'var(--wp--preset--color--tomato)',
69
+ },
70
+ blocks: {
71
+ 'core/test-fiori-di-zucca': {
72
+ color: {
73
+ text: '#000000',
74
+ },
75
+ },
76
+ },
77
+ },
78
+ settings: {
79
+ color: {
80
+ palette: {
81
+ theme: [
82
+ {
83
+ slug: 'one',
84
+ color: 'pink',
85
+ },
86
+ ],
87
+ },
88
+ },
89
+ },
90
+ };
91
+ const previousRevision = {
92
+ id: 9,
93
+ styles: {
94
+ typography: {
95
+ fontSize: 'var(--wp--preset--font-size--fungus)',
96
+ fontStyle: 'normal',
97
+ fontWeight: '600',
98
+ lineHeight: '1.85',
99
+ fontFamily: 'var(--wp--preset--font-family--grapes)',
100
+ },
101
+ spacing: {
102
+ padding: {
103
+ top: '36px',
104
+ right: '89px',
105
+ bottom: '133px',
106
+ left: 'var(--wp--preset--spacing--20)',
107
+ },
108
+ blockGap: '114px',
109
+ },
110
+ elements: {
111
+ heading: {
112
+ typography: {
113
+ letterSpacing: '37px',
114
+ },
115
+ },
116
+ h3: {
117
+ typography: {
118
+ lineHeight: '2',
119
+ },
120
+ },
121
+ h6: {
122
+ typography: {
123
+ lineHeight: '1.2',
124
+ },
125
+ },
126
+ caption: {
127
+ typography: {
128
+ fontSize: '1.11rem',
129
+ fontStyle: 'normal',
130
+ fontWeight: '600',
131
+ },
132
+ },
133
+ link: {
134
+ typography: {
135
+ lineHeight: 2,
136
+ textDecoration: 'line-through',
137
+ },
138
+ color: {
139
+ text: 'var(--wp--preset--color--egg)',
140
+ },
141
+ },
142
+ },
143
+ color: {
144
+ text: 'var(--wp--preset--color--tomato)',
145
+ background: 'var(--wp--preset--color--pumpkin)',
146
+ },
147
+ blocks: {
148
+ 'core/test-fiori-di-zucca': {
149
+ color: {
150
+ text: '#fff',
151
+ },
152
+ },
153
+ },
154
+ },
155
+ settings: {
156
+ color: {
157
+ palette: {
158
+ theme: [
159
+ {
160
+ slug: 'one',
161
+ color: 'blue',
162
+ },
163
+ ],
164
+ },
165
+ },
166
+ },
167
+ };
168
+
169
+ it( 'returns a list of changes and caches them', () => {
170
+ const resultA = getGlobalStylesChanges( revision, previousRevision );
171
+ expect( resultA ).toEqual( [
172
+ 'Colors',
173
+ 'Typography',
174
+ 'Test pumpkin flowers block',
175
+ 'H3 element',
176
+ 'Caption element',
177
+ 'H6 element',
178
+ 'Link element',
179
+ 'Color settings',
180
+ ] );
181
+
182
+ const resultB = getGlobalStylesChanges( revision, previousRevision );
183
+
184
+ expect( resultA ).toBe( resultB );
185
+ } );
186
+
187
+ it( 'returns a list of truncated changes', () => {
188
+ const resultA = getGlobalStylesChanges( revision, previousRevision, {
189
+ maxResults: 3,
190
+ } );
191
+ expect( resultA ).toEqual( [
192
+ 'Colors',
193
+ 'Typography',
194
+ 'Test pumpkin flowers block',
195
+ '…and 5 more changes.',
196
+ ] );
197
+ } );
198
+
199
+ it( 'skips unknown and unchanged keys', () => {
200
+ const result = getGlobalStylesChanges(
201
+ {
202
+ styles: {
203
+ frogs: {
204
+ legs: 'green',
205
+ },
206
+ typography: {
207
+ fontSize: '1rem',
208
+ },
209
+ settings: {
210
+ '': {
211
+ '': 'foo',
212
+ },
213
+ },
214
+ },
215
+ },
216
+ {
217
+ styles: {
218
+ frogs: {
219
+ legs: 'yellow',
220
+ },
221
+ typography: {
222
+ fontSize: '1rem',
223
+ },
224
+ settings: {
225
+ '': {
226
+ '': 'bar',
227
+ },
228
+ },
229
+ },
230
+ }
231
+ );
232
+ expect( result ).toEqual( [] );
233
+ } );
234
+ } );
@@ -21,8 +21,8 @@ import LetterSpacingControl from '../letter-spacing-control';
21
21
  import TextTransformControl from '../text-transform-control';
22
22
  import TextDecorationControl from '../text-decoration-control';
23
23
  import WritingModeControl from '../writing-mode-control';
24
- import { getValueFromVariable } from './utils';
25
- import { setImmutably } from '../../utils/object';
24
+ import { getValueFromVariable, TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils';
25
+ import { setImmutably, uniqByProperty } from '../../utils/object';
26
26
 
27
27
  const MIN_TEXT_COLUMNS = 1;
28
28
  const MAX_TEXT_COLUMNS = 6;
@@ -53,7 +53,10 @@ export function useHasTypographyPanel( settings ) {
53
53
 
54
54
  function useHasFontSizeControl( settings ) {
55
55
  return (
56
- hasMergedOrigins( settings?.typography?.fontSizes ) ||
56
+ ( settings?.typography?.defaultFontSizes !== false &&
57
+ settings?.typography?.fontSizes?.default?.length ) ||
58
+ settings?.typography?.fontSizes?.theme?.length ||
59
+ settings?.typography?.fontSizes?.custom?.length ||
57
60
  settings?.typography?.customFontSize
58
61
  );
59
62
  }
@@ -100,16 +103,45 @@ function useHasTextColumnsControl( settings ) {
100
103
  return settings?.typography?.textColumns;
101
104
  }
102
105
 
103
- function getUniqueFontSizesBySlug( settings ) {
104
- const fontSizes = settings?.typography?.fontSizes;
105
- const mergedFontSizes = fontSizes ? mergeOrigins( fontSizes ) : [];
106
- const uniqueSizes = [];
107
- for ( const currentSize of mergedFontSizes ) {
108
- if ( ! uniqueSizes.some( ( { slug } ) => slug === currentSize.slug ) ) {
109
- uniqueSizes.push( currentSize );
110
- }
111
- }
112
- return uniqueSizes;
106
+ /**
107
+ * TODO: The reversing and filtering of default font sizes is a hack so the
108
+ * dropdown UI matches what is generated in the global styles CSS stylesheet.
109
+ *
110
+ * This is a temporary solution until #57733 is resolved. At which point,
111
+ * the mergedFontSizes would just need to be the concatenated array of all
112
+ * presets or a custom dropdown with sections for each.
113
+ *
114
+ * @see {@link https://github.com/WordPress/gutenberg/issues/57733}
115
+ *
116
+ * @param {Object} settings The global styles settings.
117
+ *
118
+ * @return {Array} The merged font sizes.
119
+ */
120
+ function getMergedFontSizes( settings ) {
121
+ // The font size presets are merged in reverse order so that the duplicates
122
+ // that may defined later in the array have higher priority to match the CSS.
123
+ const mergedFontSizesAll = uniqByProperty(
124
+ [
125
+ settings?.typography?.fontSizes?.custom,
126
+ settings?.typography?.fontSizes?.theme,
127
+ settings?.typography?.fontSizes?.default,
128
+ ].flatMap( ( presets ) => presets?.toReversed() ?? [] ),
129
+ 'slug'
130
+ ).reverse();
131
+
132
+ // Default presets exist in the global styles CSS no matter the setting, so
133
+ // filtering them out in the UI has to be done after merging.
134
+ const mergedFontSizes =
135
+ settings?.typography?.defaultFontSizes === false
136
+ ? mergedFontSizesAll.filter(
137
+ ( { slug } ) =>
138
+ ! [ 'small', 'medium', 'large', 'x-large' ].includes(
139
+ slug
140
+ )
141
+ )
142
+ : mergedFontSizesAll;
143
+
144
+ return mergedFontSizes;
113
145
  }
114
146
 
115
147
  function TypographyToolsPanel( {
@@ -129,6 +161,7 @@ function TypographyToolsPanel( {
129
161
  label={ __( 'Typography' ) }
130
162
  resetAll={ resetAll }
131
163
  panelId={ panelId }
164
+ dropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS }
132
165
  >
133
166
  { children }
134
167
  </ToolsPanel>
@@ -184,7 +217,7 @@ export default function TypographyPanel( {
184
217
  // Font Size
185
218
  const hasFontSizeEnabled = useHasFontSizeControl( settings );
186
219
  const disableCustomFontSizes = ! settings?.typography?.customFontSize;
187
- const mergedFontSizes = getUniqueFontSizesBySlug( settings );
220
+ const mergedFontSizes = getMergedFontSizes( settings );
188
221
 
189
222
  const fontSize = decodeValue( inheritedValue?.typography?.fontSize );
190
223
  const setFontSize = ( newValue, metadata ) => {
@@ -11,6 +11,7 @@ import {
11
11
  import { useSelect } from '@wordpress/data';
12
12
  import { useContext, useMemo } from '@wordpress/element';
13
13
  import { getCSSRules } from '@wordpress/style-engine';
14
+ import { privateApis as componentsPrivateApis } from '@wordpress/components';
14
15
 
15
16
  /**
16
17
  * Internal dependencies
@@ -32,12 +33,9 @@ import { getDuotoneFilter } from '../duotone/utils';
32
33
  import { getGapCSSValue } from '../../hooks/gap';
33
34
  import { store as blockEditorStore } from '../../store';
34
35
  import { LAYOUT_DEFINITIONS } from '../../layouts/definitions';
35
- import {
36
- getValueFromObjectPath,
37
- kebabCase,
38
- setImmutably,
39
- } from '../../utils/object';
36
+ import { getValueFromObjectPath, setImmutably } from '../../utils/object';
40
37
  import BlockContext from '../block-context';
38
+ import { unlock } from '../../lock-unlock';
41
39
 
42
40
  // List of block support features that can have their related styles
43
41
  // generated under their own feature level selector rather than the block's.
@@ -72,6 +70,8 @@ function compileStyleValue( uncompiledValue ) {
72
70
  * @return {Array<Object>} An array of style declarations.
73
71
  */
74
72
  function getPresetsDeclarations( blockPresets = {}, mergedSettings ) {
73
+ const { kebabCase } = unlock( componentsPrivateApis );
74
+
75
75
  return PRESET_METADATA.reduce(
76
76
  ( declarations, { path, valueKey, valueFunc, cssVarInfix } ) => {
77
77
  const presetByOrigin = getValueFromObjectPath(
@@ -116,6 +116,8 @@ function getPresetsDeclarations( blockPresets = {}, mergedSettings ) {
116
116
  * @return {string} CSS declarations for the preset classes.
117
117
  */
118
118
  function getPresetsClasses( blockSelector = '*', blockPresets = {} ) {
119
+ const { kebabCase } = unlock( componentsPrivateApis );
120
+
119
121
  return PRESET_METADATA.reduce(
120
122
  ( declarations, { path, cssVarInfix, classes } ) => {
121
123
  if ( ! classes ) {
@@ -180,6 +182,7 @@ function getPresetsSvgFilters( blockPresets = {} ) {
180
182
  }
181
183
 
182
184
  function flattenTree( input = {}, prefix, token ) {
185
+ const { kebabCase } = unlock( componentsPrivateApis );
183
186
  let result = [];
184
187
  Object.keys( input ).forEach( ( key ) => {
185
188
  const newKey = prefix + kebabCase( key.replace( '/', '-' ) );
@@ -321,6 +324,7 @@ export function getStylesDeclarations(
321
324
  tree = {},
322
325
  isTemplate = true
323
326
  ) {
327
+ const { kebabCase } = unlock( componentsPrivateApis );
324
328
  const isRoot = ROOT_BLOCK_SELECTOR === selector;
325
329
  const output = Object.entries( STYLE_PROPERTY ).reduce(
326
330
  (
@@ -159,6 +159,13 @@ export const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {
159
159
  'typography.fontFamily': 'fontFamily',
160
160
  };
161
161
 
162
+ export const TOOLSPANEL_DROPDOWNMENU_PROPS = {
163
+ popoverProps: {
164
+ placement: 'left-start',
165
+ offset: 259, // Inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)
166
+ },
167
+ };
168
+
162
169
  function findInPresetsBy(
163
170
  features,
164
171
  blockName,
@@ -2,12 +2,7 @@
2
2
 
3
3
  The `HeightControl` component adds a linked unit control and slider component for controlling the height of a block within the block editor. It supports passing a label, and is used for controlling the minimum height dimensions of Group blocks.
4
4
 
5
- _Note:_ It is worth noting that the minimum height option is an opt-in feature. Themes need to declare support for it before it'll be available, and a convenient way to do that is via opting in to the [appearanceTools](/docs/how-to-guides/themes/theme-json/#opt-in-into-ui-controls) UI controls.
6
-
7
- ## Table of contents
8
-
9
- 1. [Development guidelines](#development-guidelines)
10
- 2. [Related components](#related-components)
5
+ _Note:_ It is worth noting that the minimum height option is an opt-in feature. Themes need to declare support for it before it'll be available, and a convenient way to do that is via opting in to the [appearanceTools](/docs/how-to-guides/themes/global-settings-and-styles.md#opt-in-into-ui-controls) UI controls.
11
6
 
12
7
  ## Development guidelines
13
8
 
@@ -48,7 +43,7 @@ A callback function that handles the application of the height value.
48
43
  - **Type:** `String`
49
44
  - **Default:** `'Height'`
50
45
 
51
- A label for the height control. This is useful when using the height control for a feature that is controlled in the same way as height, but requires a different label. For example, "Min. height".
46
+ A label for the height control. This is useful when using the height control for a feature that is controlled in the same way as height, but requires a different label. For example, "Minimum height".
52
47
 
53
48
  ## Related components
54
49
 
@@ -157,6 +157,8 @@ export default function HeightControl( {
157
157
  onUnitChange={ handleUnitChange }
158
158
  min={ 0 }
159
159
  size={ '__unstable-large' }
160
+ label={ label }
161
+ hideLabelFromVision
160
162
  />
161
163
  </FlexItem>
162
164
  <FlexItem isBlock>
@@ -175,6 +177,8 @@ export default function HeightControl( {
175
177
  withInputField={ false }
176
178
  onChange={ handleSliderChange }
177
179
  __nextHasNoMarginBottom
180
+ label={ label }
181
+ hideLabelFromVision
178
182
  />
179
183
  </Spacer>
180
184
  </FlexItem>
@@ -87,7 +87,7 @@ export default function ImageSizeControl( {
87
87
  return (
88
88
  <Button
89
89
  key={ scale }
90
- isSmall
90
+ size="small"
91
91
  variant={
92
92
  isCurrent ? 'primary' : undefined
93
93
  }
@@ -104,7 +104,10 @@ export default function ImageSizeControl( {
104
104
  );
105
105
  } ) }
106
106
  </ButtonGroup>
107
- <Button isSmall onClick={ () => updateDimensions() }>
107
+ <Button
108
+ size="small"
109
+ onClick={ () => updateDimensions() }
110
+ >
108
111
  { __( 'Reset' ) }
109
112
  </Button>
110
113
  </HStack>
@@ -45,13 +45,13 @@ export {
45
45
  MEDIA_TYPE_AUDIO,
46
46
  MEDIA_TYPE_ANY,
47
47
  } from './media-upload/constants';
48
+ export { default as MediaUploadProgress } from './media-upload-progress';
48
49
  export {
49
- default as MediaUploadProgress,
50
50
  MEDIA_UPLOAD_STATE_UPLOADING,
51
51
  MEDIA_UPLOAD_STATE_SUCCEEDED,
52
52
  MEDIA_UPLOAD_STATE_FAILED,
53
53
  MEDIA_UPLOAD_STATE_RESET,
54
- } from './media-upload-progress';
54
+ } from './media-upload-progress/constants';
55
55
  export { default as BlockMediaUpdateProgress } from './block-media-update-progress';
56
56
  export { default as URLInput } from './url-input';
57
57
  export { default as BlockInvalidWarning } from './block-list/block-invalid-warning';
@@ -6,7 +6,7 @@ import classnames from 'classnames';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { useViewportMatch, useMergeRefs } from '@wordpress/compose';
9
+ import { useMergeRefs } from '@wordpress/compose';
10
10
  import { forwardRef, useMemo } from '@wordpress/element';
11
11
  import { useSelect } from '@wordpress/data';
12
12
  import {
@@ -33,6 +33,15 @@ import { useSettings } from '../use-settings';
33
33
 
34
34
  const EMPTY_OBJECT = {};
35
35
 
36
+ function BlockContext( { children, clientId } ) {
37
+ const context = useBlockContext( clientId );
38
+ return (
39
+ <BlockContextProvider value={ context }>
40
+ { children }
41
+ </BlockContextProvider>
42
+ );
43
+ }
44
+
36
45
  /**
37
46
  * InnerBlocks is a component which allows a single block to have multiple blocks
38
47
  * as children. The UncontrolledInnerBlocks component is used whenever the inner
@@ -60,10 +69,15 @@ function UncontrolledInnerBlocks( props ) {
60
69
  orientation,
61
70
  placeholder,
62
71
  layout,
72
+ name,
73
+ blockType,
74
+ innerBlocks,
75
+ parentLock,
63
76
  } = props;
64
77
 
65
78
  useNestedSettingsUpdate(
66
79
  clientId,
80
+ parentLock,
67
81
  allowedBlocks,
68
82
  prioritizedInserterBlocks,
69
83
  defaultBlock,
@@ -78,19 +92,12 @@ function UncontrolledInnerBlocks( props ) {
78
92
 
79
93
  useInnerBlockTemplateSync(
80
94
  clientId,
95
+ innerBlocks,
81
96
  template,
82
97
  templateLock,
83
98
  templateInsertUpdatesSelection
84
99
  );
85
100
 
86
- const context = useBlockContext( clientId );
87
- const name = useSelect(
88
- ( select ) => {
89
- return select( blockEditorStore ).getBlock( clientId )?.name;
90
- },
91
- [ clientId ]
92
- );
93
-
94
101
  const defaultLayoutBlockSupport =
95
102
  getBlockSupport( name, 'layout' ) ||
96
103
  getBlockSupport( name, '__experimentalLayout' ) ||
@@ -114,20 +121,22 @@ function UncontrolledInnerBlocks( props ) {
114
121
  [ defaultLayout, usedLayout, allowSizingOnChildren ]
115
122
  );
116
123
 
117
- // This component needs to always be synchronous as it's the one changing
118
- // the async mode depending on the block selection.
119
- return (
120
- <BlockContextProvider value={ context }>
121
- <BlockListItems
122
- rootClientId={ clientId }
123
- renderAppender={ renderAppender }
124
- __experimentalAppenderTagName={ __experimentalAppenderTagName }
125
- layout={ memoedLayout }
126
- wrapperRef={ wrapperRef }
127
- placeholder={ placeholder }
128
- />
129
- </BlockContextProvider>
124
+ const items = (
125
+ <BlockListItems
126
+ rootClientId={ clientId }
127
+ renderAppender={ renderAppender }
128
+ __experimentalAppenderTagName={ __experimentalAppenderTagName }
129
+ layout={ memoedLayout }
130
+ wrapperRef={ wrapperRef }
131
+ placeholder={ placeholder }
132
+ />
130
133
  );
134
+
135
+ if ( Object.keys( blockType.providesContext ).length === 0 ) {
136
+ return items;
137
+ }
138
+
139
+ return <BlockContext clientId={ clientId }>{ items }</BlockContext>;
131
140
  }
132
141
 
133
142
  /**
@@ -179,8 +188,16 @@ export function useInnerBlocksProps( props = {}, options = {} ) {
179
188
  layout = null,
180
189
  __unstableLayoutClassNames: layoutClassNames = '',
181
190
  } = useBlockEditContext();
182
- const isSmallScreen = useViewportMatch( 'medium', '<' );
183
- const { __experimentalCaptureToolbars, hasOverlay } = useSelect(
191
+ const {
192
+ __experimentalCaptureToolbars,
193
+ hasOverlay,
194
+ name,
195
+ blockType,
196
+ innerBlocks,
197
+ parentLock,
198
+ parentClientId,
199
+ isDropZoneDisabled,
200
+ } = useSelect(
184
201
  ( select ) => {
185
202
  if ( ! clientId ) {
186
203
  return {};
@@ -191,14 +208,21 @@ export function useInnerBlocksProps( props = {}, options = {} ) {
191
208
  isBlockSelected,
192
209
  hasSelectedInnerBlock,
193
210
  __unstableGetEditorMode,
211
+ getBlocks,
212
+ getTemplateLock,
213
+ getBlockRootClientId,
214
+ __unstableIsWithinBlockOverlay,
215
+ __unstableHasActiveBlockOverlayActive,
216
+ getBlockEditingMode,
194
217
  } = select( blockEditorStore );
218
+ const { hasBlockSupport, getBlockType } = select( blocksStore );
195
219
  const blockName = getBlockName( clientId );
196
220
  const enableClickThrough =
197
- __unstableGetEditorMode() === 'navigation' || isSmallScreen;
221
+ __unstableGetEditorMode() === 'navigation';
222
+ const blockEditingMode = getBlockEditingMode( clientId );
223
+ const _parentClientId = getBlockRootClientId( clientId );
198
224
  return {
199
- __experimentalCaptureToolbars: select(
200
- blocksStore
201
- ).hasBlockSupport(
225
+ __experimentalCaptureToolbars: hasBlockSupport(
202
226
  blockName,
203
227
  '__experimentalExposeControlsToChildren',
204
228
  false
@@ -208,14 +232,25 @@ export function useInnerBlocksProps( props = {}, options = {} ) {
208
232
  ! isBlockSelected( clientId ) &&
209
233
  ! hasSelectedInnerBlock( clientId, true ) &&
210
234
  enableClickThrough,
235
+ name: blockName,
236
+ blockType: getBlockType( blockName ),
237
+ innerBlocks: getBlocks( clientId ),
238
+ parentLock: getTemplateLock( _parentClientId ),
239
+ parentClientId: _parentClientId,
240
+ isDropZoneDisabled:
241
+ blockEditingMode !== 'default' ||
242
+ __unstableHasActiveBlockOverlayActive( clientId ) ||
243
+ __unstableIsWithinBlockOverlay( clientId ),
211
244
  };
212
245
  },
213
- [ clientId, isSmallScreen ]
246
+ [ clientId ]
214
247
  );
215
248
 
216
249
  const blockDropZoneRef = useBlockDropZone( {
217
250
  dropZoneElement,
218
251
  rootClientId: clientId,
252
+ parentClientId,
253
+ isDisabled: isDropZoneDisabled,
219
254
  } );
220
255
 
221
256
  const ref = useMergeRefs( [
@@ -226,6 +261,10 @@ export function useInnerBlocksProps( props = {}, options = {} ) {
226
261
  const innerBlocksProps = {
227
262
  __experimentalCaptureToolbars,
228
263
  layout,
264
+ name,
265
+ blockType,
266
+ innerBlocks,
267
+ parentLock,
229
268
  ...options,
230
269
  };
231
270
  const InnerBlocks =