@wordpress/block-editor 7.0.2 → 8.0.1

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 (801) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +45 -1
  3. package/build/components/autocomplete/index.js +1 -1
  4. package/build/components/autocomplete/index.js.map +1 -1
  5. package/build/components/block-actions/index.js +8 -4
  6. package/build/components/block-actions/index.js.map +1 -1
  7. package/build/components/block-alignment-control/ui.js +61 -14
  8. package/build/components/block-alignment-control/ui.js.map +1 -1
  9. package/build/components/block-alignment-control/use-available-alignments.js +25 -3
  10. package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
  11. package/build/components/block-controls/fill.js +2 -2
  12. package/build/components/block-controls/fill.js.map +1 -1
  13. package/build/components/block-controls/hook.js +3 -3
  14. package/build/components/block-controls/hook.js.map +1 -1
  15. package/build/components/block-icon/index.js +5 -1
  16. package/build/components/block-icon/index.js.map +1 -1
  17. package/build/components/block-icon/index.native.js +9 -11
  18. package/build/components/block-icon/index.native.js.map +1 -1
  19. package/build/components/block-inspector/index.js +8 -0
  20. package/build/components/block-inspector/index.js.map +1 -1
  21. package/build/components/block-list/block-html.js +5 -0
  22. package/build/components/block-list/block-html.js.map +1 -1
  23. package/build/components/block-list/block.js +12 -5
  24. package/build/components/block-list/block.js.map +1 -1
  25. package/build/components/block-list/block.native.js +4 -3
  26. package/build/components/block-list/block.native.js.map +1 -1
  27. package/build/components/block-list/index.native.js +1 -1
  28. package/build/components/block-list/index.native.js.map +1 -1
  29. package/build/components/block-list/use-block-props/use-multi-selection.js +21 -8
  30. package/build/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
  31. package/build/components/block-list-appender/index.js +9 -1
  32. package/build/components/block-list-appender/index.js.map +1 -1
  33. package/build/components/block-mover/index.js +4 -4
  34. package/build/components/block-mover/index.js.map +1 -1
  35. package/build/components/block-mover/index.native.js +4 -4
  36. package/build/components/block-mover/index.native.js.map +1 -1
  37. package/build/components/block-navigation/dropdown.js +0 -1
  38. package/build/components/block-navigation/dropdown.js.map +1 -1
  39. package/build/components/block-patterns-list/index.js +1 -8
  40. package/build/components/block-patterns-list/index.js.map +1 -1
  41. package/build/components/block-preview/auto.js +1 -1
  42. package/build/components/block-preview/auto.js.map +1 -1
  43. package/build/components/block-settings/container.native.js +5 -2
  44. package/build/components/block-settings/container.native.js.map +1 -1
  45. package/build/components/block-settings-menu/block-settings-dropdown.js +26 -5
  46. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  47. package/build/components/block-settings-menu-controls/index.js +10 -3
  48. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  49. package/build/components/block-styles/preview.native.js +2 -2
  50. package/build/components/block-styles/preview.native.js.map +1 -1
  51. package/build/components/block-switcher/block-styles-menu.js +1 -1
  52. package/build/components/block-switcher/block-styles-menu.js.map +1 -1
  53. package/build/components/block-switcher/index.js +10 -3
  54. package/build/components/block-switcher/index.js.map +1 -1
  55. package/build/components/block-title/index.js +3 -2
  56. package/build/components/block-title/index.js.map +1 -1
  57. package/build/components/block-tools/block-popover.js +2 -4
  58. package/build/components/block-tools/block-popover.js.map +1 -1
  59. package/build/components/block-tools/index.js +4 -1
  60. package/build/components/block-tools/index.js.map +1 -1
  61. package/build/components/block-tools/insertion-point.js +96 -7
  62. package/build/components/block-tools/insertion-point.js.map +1 -1
  63. package/build/components/border-radius-control/index.js.map +1 -1
  64. package/build/components/border-radius-control/utils.js +17 -8
  65. package/build/components/border-radius-control/utils.js.map +1 -1
  66. package/build/components/colors/utils.js +11 -3
  67. package/build/components/colors/utils.js.map +1 -1
  68. package/build/components/colors-gradients/control.js +22 -57
  69. package/build/components/colors-gradients/control.js.map +1 -1
  70. package/build/components/colors-gradients/panel-color-gradient-settings.js +83 -7
  71. package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  72. package/build/components/contrast-checker/index.js +18 -12
  73. package/build/components/contrast-checker/index.js.map +1 -1
  74. package/build/components/copy-handler/index.js +9 -3
  75. package/build/components/copy-handler/index.js.map +1 -1
  76. package/build/components/default-block-appender/index.js +2 -2
  77. package/build/components/default-block-appender/index.js.map +1 -1
  78. package/build/components/duotone-control/index.js +41 -39
  79. package/build/components/duotone-control/index.js.map +1 -1
  80. package/build/components/editor-styles/index.js +9 -3
  81. package/build/components/editor-styles/index.js.map +1 -1
  82. package/build/components/font-appearance-control/index.js +32 -21
  83. package/build/components/font-appearance-control/index.js.map +1 -1
  84. package/build/components/iframe/index.js +6 -4
  85. package/build/components/iframe/index.js.map +1 -1
  86. package/build/components/image-editor/aspect-ratio-dropdown.js +126 -0
  87. package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -0
  88. package/build/components/image-editor/constants.js +16 -0
  89. package/build/components/image-editor/constants.js.map +1 -0
  90. package/build/components/image-editor/context.js +59 -0
  91. package/build/components/image-editor/context.js.map +1 -0
  92. package/build/components/image-editor/cropper.js +83 -0
  93. package/build/components/image-editor/cropper.js.map +1 -0
  94. package/build/components/image-editor/form-controls.js +36 -0
  95. package/build/components/image-editor/form-controls.js.map +1 -0
  96. package/build/components/image-editor/index.js +60 -0
  97. package/build/components/image-editor/index.js.map +1 -0
  98. package/build/components/image-editor/rotation-button.js +37 -0
  99. package/build/components/image-editor/rotation-button.js.map +1 -0
  100. package/build/components/image-editor/use-save-image.js +84 -0
  101. package/build/components/image-editor/use-save-image.js.map +1 -0
  102. package/build/components/image-editor/use-transform-image.js +135 -0
  103. package/build/components/image-editor/use-transform-image.js.map +1 -0
  104. package/build/components/image-editor/zoom-dropdown.js +55 -0
  105. package/build/components/image-editor/zoom-dropdown.js.map +1 -0
  106. package/build/components/image-size-control/use-dimension-handler.js +14 -3
  107. package/build/components/image-size-control/use-dimension-handler.js.map +1 -1
  108. package/build/components/index.js +36 -20
  109. package/build/components/index.js.map +1 -1
  110. package/build/components/index.native.js +2 -2
  111. package/build/components/index.native.js.map +1 -1
  112. package/build/components/inner-blocks/button-block-appender.js +11 -1
  113. package/build/components/inner-blocks/button-block-appender.js.map +1 -1
  114. package/build/components/inner-blocks/index.js +8 -5
  115. package/build/components/inner-blocks/index.js.map +1 -1
  116. package/build/components/inner-blocks/index.native.js +4 -3
  117. package/build/components/inner-blocks/index.native.js.map +1 -1
  118. package/build/components/inner-blocks/use-nested-settings-update.js +24 -13
  119. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  120. package/build/components/inserter/block-patterns-explorer/explorer.js +62 -0
  121. package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -0
  122. package/build/components/inserter/block-patterns-explorer/patterns-list.js +111 -0
  123. package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -0
  124. package/build/components/inserter/block-patterns-explorer/sidebar.js +78 -0
  125. package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -0
  126. package/build/components/inserter/block-patterns-tab.js +74 -35
  127. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  128. package/build/components/inserter/block-types-tab.native.js +3 -11
  129. package/build/components/inserter/block-types-tab.native.js.map +1 -1
  130. package/build/components/inserter/hooks/use-block-type-impressions.native.js +4 -7
  131. package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
  132. package/build/components/inserter/hooks/use-clipboard-block.native.js +5 -4
  133. package/build/components/inserter/hooks/use-clipboard-block.native.js.map +1 -1
  134. package/build/components/inserter/index.js +12 -4
  135. package/build/components/inserter/index.js.map +1 -1
  136. package/build/components/inserter/index.native.js +1 -7
  137. package/build/components/inserter/index.native.js.map +1 -1
  138. package/build/components/inserter/library.js +2 -0
  139. package/build/components/inserter/library.js.map +1 -1
  140. package/build/components/inserter/menu.js +2 -1
  141. package/build/components/inserter/menu.js.map +1 -1
  142. package/build/components/inserter/menu.native.js +11 -15
  143. package/build/components/inserter/menu.native.js.map +1 -1
  144. package/build/components/inserter/pattern-panel.js +19 -10
  145. package/build/components/inserter/pattern-panel.js.map +1 -1
  146. package/build/components/inserter/preview-panel.js +1 -1
  147. package/build/components/inserter/preview-panel.js.map +1 -1
  148. package/build/components/inserter/quick-inserter.js +2 -1
  149. package/build/components/inserter/quick-inserter.js.map +1 -1
  150. package/build/components/inserter/reusable-blocks-tab.native.js +5 -6
  151. package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  152. package/build/components/inserter/search-results.native.js +6 -11
  153. package/build/components/inserter/search-results.native.js.map +1 -1
  154. package/build/components/inserter/utils.native.js +44 -0
  155. package/build/components/inserter/utils.native.js.map +1 -0
  156. package/build/components/inspector-controls/block-support-slot-container.js +28 -0
  157. package/build/components/inspector-controls/block-support-slot-container.js.map +1 -0
  158. package/build/components/inspector-controls/block-support-tools-panel.js +78 -0
  159. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -0
  160. package/build/components/inspector-controls/fill.js +16 -1
  161. package/build/components/inspector-controls/fill.js.map +1 -1
  162. package/build/components/inspector-controls/groups.js +5 -1
  163. package/build/components/inspector-controls/groups.js.map +1 -1
  164. package/build/components/inspector-controls/slot.js +15 -0
  165. package/build/components/inspector-controls/slot.js.map +1 -1
  166. package/build/components/letter-spacing-control/index.js +9 -6
  167. package/build/components/letter-spacing-control/index.js.map +1 -1
  168. package/build/components/link-control/index.js +93 -34
  169. package/build/components/link-control/index.js.map +1 -1
  170. package/build/components/link-control/link-preview.js +45 -15
  171. package/build/components/link-control/link-preview.js.map +1 -1
  172. package/build/components/link-control/search-input.js +25 -7
  173. package/build/components/link-control/search-input.js.map +1 -1
  174. package/build/components/list-view/block-contents.js +1 -20
  175. package/build/components/list-view/block-contents.js.map +1 -1
  176. package/build/components/list-view/block.js +54 -69
  177. package/build/components/list-view/block.js.map +1 -1
  178. package/build/components/list-view/branch.js +102 -76
  179. package/build/components/list-view/branch.js.map +1 -1
  180. package/build/components/list-view/index.js +45 -20
  181. package/build/components/list-view/index.js.map +1 -1
  182. package/build/components/list-view/leaf.js +2 -2
  183. package/build/components/list-view/leaf.js.map +1 -1
  184. package/build/components/list-view/list-item.js +3 -2
  185. package/build/components/list-view/list-item.js.map +1 -1
  186. package/build/components/list-view/use-list-view-client-ids.js +13 -54
  187. package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
  188. package/build/components/media-placeholder/index.js +29 -20
  189. package/build/components/media-placeholder/index.js.map +1 -1
  190. package/build/components/media-replace-flow/index.js +5 -3
  191. package/build/components/media-replace-flow/index.js.map +1 -1
  192. package/build/components/navigable-toolbar/index.js +1 -4
  193. package/build/components/navigable-toolbar/index.js.map +1 -1
  194. package/build/components/observe-typing/index.js +1 -1
  195. package/build/components/observe-typing/index.js.map +1 -1
  196. package/build/components/plain-text/index.native.js +30 -1
  197. package/build/components/plain-text/index.native.js.map +1 -1
  198. package/build/components/rich-text/embed-handler-picker.native.js +66 -0
  199. package/build/components/rich-text/embed-handler-picker.native.js.map +1 -0
  200. package/build/components/rich-text/format-edit.js +28 -2
  201. package/build/components/rich-text/format-edit.js.map +1 -1
  202. package/build/components/rich-text/format-toolbar/index.js +32 -11
  203. package/build/components/rich-text/format-toolbar/index.js.map +1 -1
  204. package/build/components/rich-text/index.js +5 -1
  205. package/build/components/rich-text/index.js.map +1 -1
  206. package/build/components/rich-text/index.native.js +41 -2
  207. package/build/components/rich-text/index.native.js.map +1 -1
  208. package/build/components/rich-text/use-paste-handler.js +28 -9
  209. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  210. package/build/components/rich-text/utils.js +22 -0
  211. package/build/components/rich-text/utils.js.map +1 -1
  212. package/build/components/typewriter/index.js +1 -1
  213. package/build/components/typewriter/index.js.map +1 -1
  214. package/build/components/url-input/index.js +25 -11
  215. package/build/components/url-input/index.js.map +1 -1
  216. package/build/components/use-moving-animation/index.js +13 -10
  217. package/build/components/use-moving-animation/index.js.map +1 -1
  218. package/build/components/use-on-block-drop/index.js +2 -1
  219. package/build/components/use-on-block-drop/index.js.map +1 -1
  220. package/build/components/use-setting/index.js +48 -9
  221. package/build/components/use-setting/index.js.map +1 -1
  222. package/build/components/writing-flow/use-multi-selection.js +6 -0
  223. package/build/components/writing-flow/use-multi-selection.js.map +1 -1
  224. package/build/components/writing-flow/use-tab-nav.js +10 -1
  225. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  226. package/build/hooks/align.js +13 -10
  227. package/build/hooks/align.js.map +1 -1
  228. package/build/hooks/anchor.js +1 -1
  229. package/build/hooks/anchor.js.map +1 -1
  230. package/build/hooks/border.js +5 -5
  231. package/build/hooks/border.js.map +1 -1
  232. package/build/hooks/color-panel.js +5 -2
  233. package/build/hooks/color-panel.js.map +1 -1
  234. package/build/hooks/color.js +1 -1
  235. package/build/hooks/color.js.map +1 -1
  236. package/build/hooks/dimensions.js +23 -27
  237. package/build/hooks/dimensions.js.map +1 -1
  238. package/build/hooks/duotone.js +60 -16
  239. package/build/hooks/duotone.js.map +1 -1
  240. package/build/hooks/font-appearance.js +49 -6
  241. package/build/hooks/font-appearance.js.map +1 -1
  242. package/build/hooks/font-family.js +123 -32
  243. package/build/hooks/font-family.js.map +1 -1
  244. package/build/hooks/font-size.js +51 -9
  245. package/build/hooks/font-size.js.map +1 -1
  246. package/build/hooks/gap.js +2 -1
  247. package/build/hooks/gap.js.map +1 -1
  248. package/build/hooks/index.js +10 -0
  249. package/build/hooks/index.js.map +1 -1
  250. package/build/hooks/index.native.js +8 -0
  251. package/build/hooks/index.native.js.map +1 -1
  252. package/build/hooks/letter-spacing.js +44 -7
  253. package/build/hooks/letter-spacing.js.map +1 -1
  254. package/build/hooks/line-height.js +45 -8
  255. package/build/hooks/line-height.js.map +1 -1
  256. package/build/hooks/lock.js +43 -0
  257. package/build/hooks/lock.js.map +1 -0
  258. package/build/hooks/margin.js +1 -1
  259. package/build/hooks/margin.js.map +1 -1
  260. package/build/hooks/padding.js +1 -1
  261. package/build/hooks/padding.js.map +1 -1
  262. package/build/hooks/style.js +7 -4
  263. package/build/hooks/style.js.map +1 -1
  264. package/build/hooks/text-decoration.js +42 -6
  265. package/build/hooks/text-decoration.js.map +1 -1
  266. package/build/hooks/text-transform.js +42 -6
  267. package/build/hooks/text-transform.js.map +1 -1
  268. package/build/hooks/typography.js +108 -8
  269. package/build/hooks/typography.js.map +1 -1
  270. package/build/hooks/use-cached-truthy.js +29 -0
  271. package/build/hooks/use-cached-truthy.js.map +1 -0
  272. package/build/index.js +7 -0
  273. package/build/index.js.map +1 -1
  274. package/build/layouts/flex.js +160 -34
  275. package/build/layouts/flex.js.map +1 -1
  276. package/build/layouts/flow.js +75 -8
  277. package/build/layouts/flow.js.map +1 -1
  278. package/build/store/actions.js +323 -265
  279. package/build/store/actions.js.map +1 -1
  280. package/build/store/defaults.native.js +13 -1
  281. package/build/store/defaults.native.js.map +1 -1
  282. package/build/store/index.js +1 -3
  283. package/build/store/index.js.map +1 -1
  284. package/build/store/reducer.js +33 -22
  285. package/build/store/reducer.js.map +1 -1
  286. package/build/store/selectors.js +172 -38
  287. package/build/store/selectors.js.map +1 -1
  288. package/build/utils/index.js +10 -1
  289. package/build/utils/index.js.map +1 -1
  290. package/build/utils/parse-css-unit-to-px.js +51 -1
  291. package/build/utils/parse-css-unit-to-px.js.map +1 -1
  292. package/build/utils/transform-styles/transforms/wrap.js +16 -0
  293. package/build/utils/transform-styles/transforms/wrap.js.map +1 -1
  294. package/build-module/components/autocomplete/index.js +2 -2
  295. package/build-module/components/autocomplete/index.js.map +1 -1
  296. package/build-module/components/block-actions/index.js +8 -4
  297. package/build-module/components/block-actions/index.js.map +1 -1
  298. package/build-module/components/block-alignment-control/ui.js +64 -17
  299. package/build-module/components/block-alignment-control/ui.js.map +1 -1
  300. package/build-module/components/block-alignment-control/use-available-alignments.js +25 -3
  301. package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
  302. package/build-module/components/block-controls/fill.js +2 -2
  303. package/build-module/components/block-controls/fill.js.map +1 -1
  304. package/build-module/components/block-controls/hook.js +3 -3
  305. package/build-module/components/block-controls/hook.js.map +1 -1
  306. package/build-module/components/block-icon/index.js +5 -1
  307. package/build-module/components/block-icon/index.js.map +1 -1
  308. package/build-module/components/block-icon/index.native.js +10 -11
  309. package/build-module/components/block-icon/index.native.js.map +1 -1
  310. package/build-module/components/block-inspector/index.js +8 -0
  311. package/build-module/components/block-inspector/index.js.map +1 -1
  312. package/build-module/components/block-list/block-html.js +5 -0
  313. package/build-module/components/block-list/block-html.js.map +1 -1
  314. package/build-module/components/block-list/block.js +12 -5
  315. package/build-module/components/block-list/block.js.map +1 -1
  316. package/build-module/components/block-list/block.native.js +4 -3
  317. package/build-module/components/block-list/block.native.js.map +1 -1
  318. package/build-module/components/block-list/index.native.js +1 -1
  319. package/build-module/components/block-list/index.native.js.map +1 -1
  320. package/build-module/components/block-list/use-block-props/use-multi-selection.js +21 -8
  321. package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
  322. package/build-module/components/block-list-appender/index.js +9 -1
  323. package/build-module/components/block-list-appender/index.js.map +1 -1
  324. package/build-module/components/block-mover/index.js +4 -4
  325. package/build-module/components/block-mover/index.js.map +1 -1
  326. package/build-module/components/block-mover/index.native.js +4 -4
  327. package/build-module/components/block-mover/index.native.js.map +1 -1
  328. package/build-module/components/block-navigation/dropdown.js +0 -1
  329. package/build-module/components/block-navigation/dropdown.js.map +1 -1
  330. package/build-module/components/block-patterns-list/index.js +1 -6
  331. package/build-module/components/block-patterns-list/index.js.map +1 -1
  332. package/build-module/components/block-preview/auto.js +1 -1
  333. package/build-module/components/block-preview/auto.js.map +1 -1
  334. package/build-module/components/block-settings/container.native.js +6 -3
  335. package/build-module/components/block-settings/container.native.js.map +1 -1
  336. package/build-module/components/block-settings-menu/block-settings-dropdown.js +28 -7
  337. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  338. package/build-module/components/block-settings-menu-controls/index.js +10 -3
  339. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  340. package/build-module/components/block-styles/preview.native.js +2 -2
  341. package/build-module/components/block-styles/preview.native.js.map +1 -1
  342. package/build-module/components/block-switcher/block-styles-menu.js +1 -1
  343. package/build-module/components/block-switcher/block-styles-menu.js.map +1 -1
  344. package/build-module/components/block-switcher/index.js +10 -3
  345. package/build-module/components/block-switcher/index.js.map +1 -1
  346. package/build-module/components/block-title/index.js +3 -2
  347. package/build-module/components/block-title/index.js.map +1 -1
  348. package/build-module/components/block-tools/block-popover.js +3 -5
  349. package/build-module/components/block-tools/block-popover.js.map +1 -1
  350. package/build-module/components/block-tools/index.js +4 -1
  351. package/build-module/components/block-tools/index.js.map +1 -1
  352. package/build-module/components/block-tools/insertion-point.js +96 -8
  353. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  354. package/build-module/components/border-radius-control/index.js.map +1 -1
  355. package/build-module/components/border-radius-control/utils.js +16 -9
  356. package/build-module/components/border-radius-control/utils.js.map +1 -1
  357. package/build-module/components/colors/utils.js +9 -3
  358. package/build-module/components/colors/utils.js.map +1 -1
  359. package/build-module/components/colors-gradients/control.js +26 -63
  360. package/build-module/components/colors-gradients/control.js.map +1 -1
  361. package/build-module/components/colors-gradients/panel-color-gradient-settings.js +84 -7
  362. package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  363. package/build-module/components/contrast-checker/index.js +13 -10
  364. package/build-module/components/contrast-checker/index.js.map +1 -1
  365. package/build-module/components/copy-handler/index.js +9 -3
  366. package/build-module/components/copy-handler/index.js.map +1 -1
  367. package/build-module/components/default-block-appender/index.js +2 -2
  368. package/build-module/components/default-block-appender/index.js.map +1 -1
  369. package/build-module/components/duotone-control/index.js +43 -39
  370. package/build-module/components/duotone-control/index.js.map +1 -1
  371. package/build-module/components/editor-styles/index.js +7 -3
  372. package/build-module/components/editor-styles/index.js.map +1 -1
  373. package/build-module/components/font-appearance-control/index.js +28 -21
  374. package/build-module/components/font-appearance-control/index.js.map +1 -1
  375. package/build-module/components/iframe/index.js +6 -4
  376. package/build-module/components/iframe/index.js.map +1 -1
  377. package/build-module/components/image-editor/aspect-ratio-dropdown.js +115 -0
  378. package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -0
  379. package/build-module/components/image-editor/constants.js +7 -0
  380. package/build-module/components/image-editor/constants.js.map +1 -0
  381. package/build-module/components/image-editor/context.js +44 -0
  382. package/build-module/components/image-editor/context.js.map +1 -0
  383. package/build-module/components/image-editor/cropper.js +69 -0
  384. package/build-module/components/image-editor/cropper.js.map +1 -0
  385. package/build-module/components/image-editor/form-controls.js +26 -0
  386. package/build-module/components/image-editor/form-controls.js.map +1 -0
  387. package/build-module/components/image-editor/index.js +37 -0
  388. package/build-module/components/image-editor/index.js.map +1 -0
  389. package/build-module/components/image-editor/rotation-button.js +26 -0
  390. package/build-module/components/image-editor/rotation-button.js.map +1 -0
  391. package/build-module/components/image-editor/use-save-image.js +70 -0
  392. package/build-module/components/image-editor/use-save-image.js.map +1 -0
  393. package/build-module/components/image-editor/use-transform-image.js +127 -0
  394. package/build-module/components/image-editor/use-transform-image.js.map +1 -0
  395. package/build-module/components/image-editor/zoom-dropdown.js +43 -0
  396. package/build-module/components/image-editor/zoom-dropdown.js.map +1 -0
  397. package/build-module/components/image-size-control/use-dimension-handler.js +13 -2
  398. package/build-module/components/image-size-control/use-dimension-handler.js.map +1 -1
  399. package/build-module/components/index.js +4 -3
  400. package/build-module/components/index.js.map +1 -1
  401. package/build-module/components/index.native.js +1 -1
  402. package/build-module/components/index.native.js.map +1 -1
  403. package/build-module/components/inner-blocks/button-block-appender.js +10 -1
  404. package/build-module/components/inner-blocks/button-block-appender.js.map +1 -1
  405. package/build-module/components/inner-blocks/index.js +9 -6
  406. package/build-module/components/inner-blocks/index.js.map +1 -1
  407. package/build-module/components/inner-blocks/index.native.js +5 -4
  408. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  409. package/build-module/components/inner-blocks/use-nested-settings-update.js +24 -13
  410. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  411. package/build-module/components/inserter/block-patterns-explorer/explorer.js +50 -0
  412. package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -0
  413. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +92 -0
  414. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -0
  415. package/build-module/components/inserter/block-patterns-explorer/sidebar.js +69 -0
  416. package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -0
  417. package/build-module/components/inserter/block-patterns-tab.js +75 -36
  418. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  419. package/build-module/components/inserter/block-types-tab.native.js +2 -10
  420. package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
  421. package/build-module/components/inserter/hooks/use-block-type-impressions.native.js +4 -7
  422. package/build-module/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
  423. package/build-module/components/inserter/hooks/use-clipboard-block.native.js +5 -4
  424. package/build-module/components/inserter/hooks/use-clipboard-block.native.js.map +1 -1
  425. package/build-module/components/inserter/index.js +12 -4
  426. package/build-module/components/inserter/index.js.map +1 -1
  427. package/build-module/components/inserter/index.native.js +1 -7
  428. package/build-module/components/inserter/index.native.js.map +1 -1
  429. package/build-module/components/inserter/library.js +2 -0
  430. package/build-module/components/inserter/library.js.map +1 -1
  431. package/build-module/components/inserter/menu.js +2 -1
  432. package/build-module/components/inserter/menu.js.map +1 -1
  433. package/build-module/components/inserter/menu.native.js +10 -15
  434. package/build-module/components/inserter/menu.native.js.map +1 -1
  435. package/build-module/components/inserter/pattern-panel.js +21 -13
  436. package/build-module/components/inserter/pattern-panel.js.map +1 -1
  437. package/build-module/components/inserter/preview-panel.js +1 -1
  438. package/build-module/components/inserter/preview-panel.js.map +1 -1
  439. package/build-module/components/inserter/quick-inserter.js +2 -1
  440. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  441. package/build-module/components/inserter/reusable-blocks-tab.native.js +4 -5
  442. package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  443. package/build-module/components/inserter/search-results.native.js +5 -10
  444. package/build-module/components/inserter/search-results.native.js.map +1 -1
  445. package/build-module/components/inserter/utils.native.js +35 -0
  446. package/build-module/components/inserter/utils.native.js.map +1 -0
  447. package/build-module/components/inspector-controls/block-support-slot-container.js +18 -0
  448. package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -0
  449. package/build-module/components/inspector-controls/block-support-tools-panel.js +67 -0
  450. package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -0
  451. package/build-module/components/inspector-controls/fill.js +16 -2
  452. package/build-module/components/inspector-controls/fill.js.map +1 -1
  453. package/build-module/components/inspector-controls/groups.js +5 -1
  454. package/build-module/components/inspector-controls/groups.js.map +1 -1
  455. package/build-module/components/inspector-controls/slot.js +13 -0
  456. package/build-module/components/inspector-controls/slot.js.map +1 -1
  457. package/build-module/components/letter-spacing-control/index.js +9 -6
  458. package/build-module/components/letter-spacing-control/index.js.map +1 -1
  459. package/build-module/components/link-control/index.js +93 -35
  460. package/build-module/components/link-control/index.js.map +1 -1
  461. package/build-module/components/link-control/link-preview.js +46 -17
  462. package/build-module/components/link-control/link-preview.js.map +1 -1
  463. package/build-module/components/link-control/search-input.js +24 -7
  464. package/build-module/components/link-control/search-input.js.map +1 -1
  465. package/build-module/components/list-view/block-contents.js +1 -18
  466. package/build-module/components/list-view/block-contents.js.map +1 -1
  467. package/build-module/components/list-view/block.js +56 -71
  468. package/build-module/components/list-view/block.js.map +1 -1
  469. package/build-module/components/list-view/branch.js +102 -78
  470. package/build-module/components/list-view/branch.js.map +1 -1
  471. package/build-module/components/list-view/index.js +48 -23
  472. package/build-module/components/list-view/index.js.map +1 -1
  473. package/build-module/components/list-view/leaf.js +2 -2
  474. package/build-module/components/list-view/leaf.js.map +1 -1
  475. package/build-module/components/list-view/list-item.js +3 -2
  476. package/build-module/components/list-view/list-item.js.map +1 -1
  477. package/build-module/components/list-view/use-list-view-client-ids.js +13 -54
  478. package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
  479. package/build-module/components/media-placeholder/index.js +29 -20
  480. package/build-module/components/media-placeholder/index.js.map +1 -1
  481. package/build-module/components/media-replace-flow/index.js +5 -3
  482. package/build-module/components/media-replace-flow/index.js.map +1 -1
  483. package/build-module/components/navigable-toolbar/index.js +1 -4
  484. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  485. package/build-module/components/observe-typing/index.js +1 -1
  486. package/build-module/components/observe-typing/index.js.map +1 -1
  487. package/build-module/components/plain-text/index.native.js +29 -2
  488. package/build-module/components/plain-text/index.native.js.map +1 -1
  489. package/build-module/components/rich-text/embed-handler-picker.native.js +54 -0
  490. package/build-module/components/rich-text/embed-handler-picker.native.js.map +1 -0
  491. package/build-module/components/rich-text/format-edit.js +28 -3
  492. package/build-module/components/rich-text/format-edit.js.map +1 -1
  493. package/build-module/components/rich-text/format-toolbar/index.js +29 -11
  494. package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
  495. package/build-module/components/rich-text/index.js +4 -1
  496. package/build-module/components/rich-text/index.js.map +1 -1
  497. package/build-module/components/rich-text/index.native.js +41 -3
  498. package/build-module/components/rich-text/index.native.js.map +1 -1
  499. package/build-module/components/rich-text/use-paste-handler.js +28 -9
  500. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  501. package/build-module/components/rich-text/utils.js +20 -0
  502. package/build-module/components/rich-text/utils.js.map +1 -1
  503. package/build-module/components/typewriter/index.js +1 -1
  504. package/build-module/components/typewriter/index.js.map +1 -1
  505. package/build-module/components/url-input/index.js +25 -11
  506. package/build-module/components/url-input/index.js.map +1 -1
  507. package/build-module/components/use-moving-animation/index.js +13 -10
  508. package/build-module/components/use-moving-animation/index.js.map +1 -1
  509. package/build-module/components/use-on-block-drop/index.js +3 -2
  510. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  511. package/build-module/components/use-setting/index.js +48 -9
  512. package/build-module/components/use-setting/index.js.map +1 -1
  513. package/build-module/components/writing-flow/use-multi-selection.js +6 -0
  514. package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
  515. package/build-module/components/writing-flow/use-tab-nav.js +10 -1
  516. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  517. package/build-module/hooks/align.js +13 -10
  518. package/build-module/hooks/align.js.map +1 -1
  519. package/build-module/hooks/anchor.js +1 -1
  520. package/build-module/hooks/anchor.js.map +1 -1
  521. package/build-module/hooks/border.js +5 -5
  522. package/build-module/hooks/border.js.map +1 -1
  523. package/build-module/hooks/color-panel.js +6 -3
  524. package/build-module/hooks/color-panel.js.map +1 -1
  525. package/build-module/hooks/color.js +1 -1
  526. package/build-module/hooks/color.js.map +1 -1
  527. package/build-module/hooks/dimensions.js +24 -27
  528. package/build-module/hooks/dimensions.js.map +1 -1
  529. package/build-module/hooks/duotone.js +59 -16
  530. package/build-module/hooks/duotone.js.map +1 -1
  531. package/build-module/hooks/font-appearance.js +45 -6
  532. package/build-module/hooks/font-appearance.js.map +1 -1
  533. package/build-module/hooks/font-family.js +117 -33
  534. package/build-module/hooks/font-family.js.map +1 -1
  535. package/build-module/hooks/font-size.js +47 -9
  536. package/build-module/hooks/font-size.js.map +1 -1
  537. package/build-module/hooks/gap.js +2 -1
  538. package/build-module/hooks/gap.js.map +1 -1
  539. package/build-module/hooks/index.js +2 -0
  540. package/build-module/hooks/index.js.map +1 -1
  541. package/build-module/hooks/index.native.js +1 -0
  542. package/build-module/hooks/index.native.js.map +1 -1
  543. package/build-module/hooks/letter-spacing.js +40 -7
  544. package/build-module/hooks/letter-spacing.js.map +1 -1
  545. package/build-module/hooks/line-height.js +41 -8
  546. package/build-module/hooks/line-height.js.map +1 -1
  547. package/build-module/hooks/lock.js +33 -0
  548. package/build-module/hooks/lock.js.map +1 -0
  549. package/build-module/hooks/margin.js +1 -1
  550. package/build-module/hooks/margin.js.map +1 -1
  551. package/build-module/hooks/padding.js +1 -1
  552. package/build-module/hooks/padding.js.map +1 -1
  553. package/build-module/hooks/style.js +7 -4
  554. package/build-module/hooks/style.js.map +1 -1
  555. package/build-module/hooks/text-decoration.js +38 -6
  556. package/build-module/hooks/text-decoration.js.map +1 -1
  557. package/build-module/hooks/text-transform.js +38 -6
  558. package/build-module/hooks/text-transform.js.map +1 -1
  559. package/build-module/hooks/typography.js +117 -17
  560. package/build-module/hooks/typography.js.map +1 -1
  561. package/build-module/hooks/use-cached-truthy.js +21 -0
  562. package/build-module/hooks/use-cached-truthy.js.map +1 -0
  563. package/build-module/index.js +1 -1
  564. package/build-module/index.js.map +1 -1
  565. package/build-module/layouts/flex.js +163 -38
  566. package/build-module/layouts/flex.js.map +1 -1
  567. package/build-module/layouts/flow.js +74 -8
  568. package/build-module/layouts/flow.js.map +1 -1
  569. package/build-module/store/actions.js +286 -241
  570. package/build-module/store/actions.js.map +1 -1
  571. package/build-module/store/defaults.native.js +12 -1
  572. package/build-module/store/defaults.native.js.map +1 -1
  573. package/build-module/store/index.js +1 -2
  574. package/build-module/store/index.js.map +1 -1
  575. package/build-module/store/reducer.js +33 -22
  576. package/build-module/store/reducer.js.map +1 -1
  577. package/build-module/store/selectors.js +160 -34
  578. package/build-module/store/selectors.js.map +1 -1
  579. package/build-module/utils/index.js +1 -0
  580. package/build-module/utils/index.js.map +1 -1
  581. package/build-module/utils/parse-css-unit-to-px.js +48 -1
  582. package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
  583. package/build-module/utils/transform-styles/transforms/wrap.js +16 -0
  584. package/build-module/utils/transform-styles/transforms/wrap.js.map +1 -1
  585. package/build-style/style-rtl.css +267 -144
  586. package/build-style/style.css +267 -144
  587. package/package.json +28 -27
  588. package/src/components/autocomplete/index.js +5 -2
  589. package/src/components/block-actions/index.js +9 -5
  590. package/src/components/block-alignment-control/style.scss +5 -0
  591. package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +15 -1
  592. package/src/components/block-alignment-control/test/index.native.js +37 -0
  593. package/src/components/block-alignment-control/ui.js +98 -27
  594. package/src/components/block-alignment-control/use-available-alignments.js +31 -10
  595. package/src/components/block-controls/fill.js +5 -2
  596. package/src/components/block-controls/hook.js +3 -3
  597. package/src/components/block-draggable/style.scss +19 -4
  598. package/src/components/block-icon/index.js +4 -1
  599. package/src/components/block-icon/index.native.js +10 -16
  600. package/src/components/block-inspector/index.js +10 -0
  601. package/src/components/block-list/block-html.js +5 -0
  602. package/src/components/block-list/block.js +11 -3
  603. package/src/components/block-list/block.native.js +5 -3
  604. package/src/components/block-list/index.native.js +1 -1
  605. package/src/components/block-list/style.scss +15 -0
  606. package/src/components/block-list/use-block-props/use-multi-selection.js +27 -7
  607. package/src/components/block-list-appender/index.js +8 -0
  608. package/src/components/block-mover/index.js +4 -4
  609. package/src/components/block-mover/index.native.js +4 -4
  610. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +10 -6
  611. package/src/components/block-mover/test/index.native.js +26 -28
  612. package/src/components/block-navigation/dropdown.js +0 -1
  613. package/src/components/block-patterns-list/index.js +1 -8
  614. package/src/components/block-patterns-list/style.scss +22 -12
  615. package/src/components/block-preview/README.md +1 -1
  616. package/src/components/block-preview/auto.js +1 -1
  617. package/src/components/block-preview/style.scss +0 -17
  618. package/src/components/block-settings/container.native.js +7 -0
  619. package/src/components/block-settings-menu/block-settings-dropdown.js +26 -13
  620. package/src/components/block-settings-menu-controls/index.js +9 -6
  621. package/src/components/block-styles/preview.native.js +2 -2
  622. package/src/components/block-switcher/block-styles-menu.js +1 -1
  623. package/src/components/block-switcher/index.js +7 -3
  624. package/src/components/block-switcher/test/__snapshots__/index.js.snap +1 -1
  625. package/src/components/block-switcher/test/index.js +3 -0
  626. package/src/components/block-title/index.js +5 -2
  627. package/src/components/block-tools/block-popover.js +3 -5
  628. package/src/components/block-tools/index.js +5 -2
  629. package/src/components/block-tools/insertion-point.js +97 -9
  630. package/src/components/block-tools/style.scss +4 -35
  631. package/src/components/block-types-list/style.scss +0 -3
  632. package/src/components/border-radius-control/index.js +1 -0
  633. package/src/components/border-radius-control/test/utils.js +216 -0
  634. package/src/components/border-radius-control/utils.js +18 -10
  635. package/src/components/color-palette/test/__snapshots__/control.js.snap +128 -71
  636. package/src/components/colors/test/utils.js +41 -0
  637. package/src/components/colors/utils.js +9 -5
  638. package/src/components/colors-gradients/control.js +70 -110
  639. package/src/components/colors-gradients/panel-color-gradient-settings.js +79 -7
  640. package/src/components/colors-gradients/style.scss +10 -18
  641. package/src/components/colors-gradients/test/control.js +41 -66
  642. package/src/components/contrast-checker/index.js +14 -10
  643. package/src/components/copy-handler/index.js +6 -1
  644. package/src/components/default-block-appender/index.js +2 -2
  645. package/src/components/default-block-appender/test/__snapshots__/index.js.snap +3 -3
  646. package/src/components/duotone-control/index.js +49 -41
  647. package/src/components/duotone-control/style.scss +27 -12
  648. package/src/components/editor-styles/index.js +7 -4
  649. package/src/components/font-appearance-control/index.js +41 -33
  650. package/src/components/font-appearance-control/style.scss +1 -1
  651. package/src/components/iframe/index.js +4 -4
  652. package/src/components/image-editor/aspect-ratio-dropdown.js +129 -0
  653. package/src/components/image-editor/constants.js +6 -0
  654. package/src/components/image-editor/context.js +56 -0
  655. package/src/components/image-editor/cropper.js +74 -0
  656. package/src/components/image-editor/form-controls.js +22 -0
  657. package/src/components/image-editor/index.js +52 -0
  658. package/src/components/image-editor/rotation-button.js +24 -0
  659. package/src/components/image-editor/use-save-image.js +97 -0
  660. package/src/components/image-editor/use-transform-image.js +162 -0
  661. package/src/components/image-editor/zoom-dropdown.js +40 -0
  662. package/src/components/image-size-control/use-dimension-handler.js +18 -1
  663. package/src/components/index.js +7 -6
  664. package/src/components/index.native.js +1 -4
  665. package/src/components/inner-blocks/button-block-appender.js +9 -0
  666. package/src/components/inner-blocks/index.js +8 -4
  667. package/src/components/inner-blocks/index.native.js +7 -4
  668. package/src/components/inner-blocks/use-nested-settings-update.js +26 -11
  669. package/src/components/inserter/block-patterns-explorer/explorer.js +50 -0
  670. package/src/components/inserter/block-patterns-explorer/patterns-list.js +122 -0
  671. package/src/components/inserter/block-patterns-explorer/sidebar.js +73 -0
  672. package/src/components/inserter/block-patterns-tab.js +107 -73
  673. package/src/components/inserter/block-types-tab.native.js +3 -15
  674. package/src/components/inserter/hooks/use-block-type-impressions.native.js +14 -21
  675. package/src/components/inserter/hooks/use-clipboard-block.native.js +3 -2
  676. package/src/components/inserter/index.js +15 -3
  677. package/src/components/inserter/index.native.js +2 -19
  678. package/src/components/inserter/library.js +2 -0
  679. package/src/components/inserter/menu.js +4 -1
  680. package/src/components/inserter/menu.native.js +9 -14
  681. package/src/components/inserter/pattern-panel.js +33 -16
  682. package/src/components/inserter/preview-panel.js +1 -1
  683. package/src/components/inserter/quick-inserter.js +1 -1
  684. package/src/components/inserter/reusable-blocks-tab.native.js +4 -6
  685. package/src/components/inserter/search-results.native.js +5 -15
  686. package/src/components/inserter/style.scss +80 -16
  687. package/src/components/inserter/test/block-types-tab.native.js +1 -1
  688. package/src/components/inserter/test/fixtures/index.native.js +12 -0
  689. package/src/components/inserter/utils.native.js +35 -0
  690. package/src/components/inserter-list-item/style.scss +4 -2
  691. package/src/components/inspector-controls/block-support-slot-container.js +10 -0
  692. package/src/components/inspector-controls/block-support-tools-panel.js +60 -0
  693. package/src/components/inspector-controls/fill.js +23 -2
  694. package/src/components/inspector-controls/groups.js +8 -0
  695. package/src/components/inspector-controls/slot.js +15 -0
  696. package/src/components/letter-spacing-control/index.js +12 -6
  697. package/src/components/link-control/README.md +47 -14
  698. package/src/components/link-control/index.js +102 -31
  699. package/src/components/link-control/link-preview.js +53 -20
  700. package/src/components/link-control/search-input.js +21 -7
  701. package/src/components/link-control/style.scss +66 -19
  702. package/src/components/link-control/test/index.js +311 -4
  703. package/src/components/list-view/block-contents.js +17 -38
  704. package/src/components/list-view/block.js +73 -84
  705. package/src/components/list-view/branch.js +123 -94
  706. package/src/components/list-view/index.js +82 -30
  707. package/src/components/list-view/leaf.js +2 -2
  708. package/src/components/list-view/list-item.js +5 -4
  709. package/src/components/list-view/style.scss +70 -33
  710. package/src/components/list-view/use-list-view-client-ids.js +9 -68
  711. package/src/components/media-placeholder/index.js +26 -19
  712. package/src/components/media-replace-flow/README.md +7 -0
  713. package/src/components/media-replace-flow/index.js +4 -1
  714. package/src/components/media-upload/README.md +1 -1
  715. package/src/components/navigable-toolbar/index.js +1 -4
  716. package/src/components/observe-typing/index.js +3 -2
  717. package/src/components/plain-text/index.native.js +26 -4
  718. package/src/components/rich-text/embed-handler-picker.native.js +68 -0
  719. package/src/components/rich-text/format-edit.js +36 -2
  720. package/src/components/rich-text/format-toolbar/index.js +25 -6
  721. package/src/components/rich-text/index.js +12 -8
  722. package/src/components/rich-text/index.native.js +35 -1
  723. package/src/components/rich-text/use-paste-handler.js +30 -12
  724. package/src/components/rich-text/utils.js +16 -0
  725. package/src/components/skip-to-selected-block/README.md +39 -0
  726. package/src/components/typewriter/index.js +3 -2
  727. package/src/components/url-input/index.js +26 -10
  728. package/src/components/use-moving-animation/index.js +9 -8
  729. package/src/components/use-on-block-drop/index.js +5 -1
  730. package/src/components/use-setting/index.js +49 -11
  731. package/src/components/writing-flow/use-multi-selection.js +6 -0
  732. package/src/components/writing-flow/use-tab-nav.js +17 -3
  733. package/src/hooks/align.js +19 -10
  734. package/src/hooks/anchor.js +2 -2
  735. package/src/hooks/border.js +8 -11
  736. package/src/hooks/color-panel.js +4 -1
  737. package/src/hooks/color.js +7 -4
  738. package/src/hooks/dimensions.js +48 -59
  739. package/src/hooks/duotone.js +68 -19
  740. package/src/hooks/font-appearance.js +38 -7
  741. package/src/hooks/font-family.js +129 -33
  742. package/src/hooks/font-size.js +42 -6
  743. package/src/hooks/gap.js +2 -1
  744. package/src/hooks/index.js +2 -0
  745. package/src/hooks/index.native.js +1 -0
  746. package/src/hooks/layout.scss +8 -0
  747. package/src/hooks/letter-spacing.js +35 -7
  748. package/src/hooks/line-height.js +37 -9
  749. package/src/hooks/lock.js +34 -0
  750. package/src/hooks/margin.js +1 -1
  751. package/src/hooks/padding.js +1 -1
  752. package/src/hooks/style.js +15 -11
  753. package/src/hooks/text-decoration.js +34 -6
  754. package/src/hooks/text-transform.js +34 -6
  755. package/src/hooks/typography.js +165 -15
  756. package/src/hooks/typography.scss +16 -0
  757. package/src/hooks/use-cached-truthy.js +20 -0
  758. package/src/index.js +1 -0
  759. package/src/layouts/flex.js +179 -50
  760. package/src/layouts/flow.js +54 -8
  761. package/src/store/actions.js +239 -377
  762. package/src/store/defaults.native.js +12 -0
  763. package/src/store/index.js +1 -2
  764. package/src/store/reducer.js +54 -18
  765. package/src/store/selectors.js +173 -47
  766. package/src/store/test/actions.js +407 -705
  767. package/src/store/test/reducer.js +22 -54
  768. package/src/store/test/selectors.js +79 -21
  769. package/src/style.scss +2 -1
  770. package/src/utils/index.js +1 -0
  771. package/src/utils/parse-css-unit-to-px.js +43 -1
  772. package/src/utils/test/parse-css-unit-to-px.js +148 -165
  773. package/src/utils/transform-styles/transforms/test/wrap.js +1 -1
  774. package/src/utils/transform-styles/transforms/wrap.js +16 -0
  775. package/tsconfig.tsbuildinfo +1 -1
  776. package/build/components/duotone-control/duotone-picker-popover.js +0 -44
  777. package/build/components/duotone-control/duotone-picker-popover.js.map +0 -1
  778. package/build/components/list-view/block-slot.js +0 -121
  779. package/build/components/list-view/block-slot.js.map +0 -1
  780. package/build/components/list-view/editor.js +0 -35
  781. package/build/components/list-view/editor.js.map +0 -1
  782. package/build/components/text-decoration-and-transform/index.js +0 -39
  783. package/build/components/text-decoration-and-transform/index.js.map +0 -1
  784. package/build/store/controls.js +0 -44
  785. package/build/store/controls.js.map +0 -1
  786. package/build-module/components/duotone-control/duotone-picker-popover.js +0 -35
  787. package/build-module/components/duotone-control/duotone-picker-popover.js.map +0 -1
  788. package/build-module/components/list-view/block-slot.js +0 -96
  789. package/build-module/components/list-view/block-slot.js.map +0 -1
  790. package/build-module/components/list-view/editor.js +0 -25
  791. package/build-module/components/list-view/editor.js.map +0 -1
  792. package/build-module/components/text-decoration-and-transform/index.js +0 -30
  793. package/build-module/components/text-decoration-and-transform/index.js.map +0 -1
  794. package/build-module/store/controls.js +0 -32
  795. package/build-module/store/controls.js.map +0 -1
  796. package/src/components/duotone-control/duotone-picker-popover.js +0 -36
  797. package/src/components/list-view/block-slot.js +0 -120
  798. package/src/components/list-view/editor.js +0 -29
  799. package/src/components/text-decoration-and-transform/index.js +0 -36
  800. package/src/components/text-decoration-and-transform/style.scss +0 -3
  801. package/src/store/controls.js +0 -39
@@ -19,61 +19,44 @@ import {
19
19
  } from '@wordpress/blocks';
20
20
  import { speak } from '@wordpress/a11y';
21
21
  import { __, _n, sprintf } from '@wordpress/i18n';
22
- import { controls } from '@wordpress/data';
23
22
  import { create, insert, remove, toHTMLString } from '@wordpress/rich-text';
24
23
  import deprecated from '@wordpress/deprecated';
25
24
 
26
25
  /**
27
- * Internal dependencies
28
- */
29
- import { __unstableMarkAutomaticChangeFinalControl } from '../store/controls';
30
- import { STORE_NAME as blockEditorStoreName } from './constants';
31
-
32
- /**
33
- * Generator which will yield a default block insert action if there
34
- * are no other blocks at the root of the editor. This generator should be used
26
+ * Action which will insert a default block insert action if there
27
+ * are no other blocks at the root of the editor. This action should be used
35
28
  * in actions which may result in no blocks remaining in the editor (removal,
36
29
  * replacement, etc).
37
30
  */
38
- function* ensureDefaultBlock() {
39
- const count = yield controls.select(
40
- blockEditorStoreName,
41
- 'getBlockCount'
42
- );
43
-
31
+ const ensureDefaultBlock = () => ( { select, dispatch } ) => {
44
32
  // To avoid a focus loss when removing the last block, assure there is
45
33
  // always a default block if the last of the blocks have been removed.
46
- if ( count === 0 ) {
47
- const { __unstableHasCustomAppender } = yield controls.select(
48
- blockEditorStoreName,
49
- 'getSettings'
50
- );
51
-
52
- // If there's an custom appender, don't insert default block.
53
- // We have to remember to manually move the focus elsewhere to
54
- // prevent it from being lost though.
55
- if ( __unstableHasCustomAppender ) {
56
- return;
57
- }
34
+ const count = select.getBlockCount();
35
+ if ( count > 0 ) {
36
+ return;
37
+ }
58
38
 
59
- return yield insertDefaultBlock();
39
+ // If there's an custom appender, don't insert default block.
40
+ // We have to remember to manually move the focus elsewhere to
41
+ // prevent it from being lost though.
42
+ const { __unstableHasCustomAppender } = select.getSettings();
43
+ if ( __unstableHasCustomAppender ) {
44
+ return;
60
45
  }
61
- }
46
+
47
+ dispatch.insertDefaultBlock();
48
+ };
62
49
 
63
50
  /**
64
- * Returns an action object used in signalling that blocks state should be
65
- * reset to the specified array of blocks, taking precedence over any other
66
- * content reflected as an edit in state.
51
+ * Action that resets blocks state to the specified array of blocks, taking precedence
52
+ * over any other content reflected as an edit in state.
67
53
  *
68
54
  * @param {Array} blocks Array of blocks.
69
55
  */
70
- export function* resetBlocks( blocks ) {
71
- yield {
72
- type: 'RESET_BLOCKS',
73
- blocks,
74
- };
75
- return yield* validateBlocksToTemplate( blocks );
76
- }
56
+ export const resetBlocks = ( blocks ) => ( { dispatch } ) => {
57
+ dispatch( { type: 'RESET_BLOCKS', blocks } );
58
+ dispatch( validateBlocksToTemplate( blocks ) );
59
+ };
77
60
 
78
61
  /**
79
62
  * Block validity is a function of blocks state (at the point of a
@@ -83,15 +66,12 @@ export function* resetBlocks( blocks ) {
83
66
  *
84
67
  * @param {Array} blocks Array of blocks.
85
68
  */
86
- export function* validateBlocksToTemplate( blocks ) {
87
- const template = yield controls.select(
88
- blockEditorStoreName,
89
- 'getTemplate'
90
- );
91
- const templateLock = yield controls.select(
92
- blockEditorStoreName,
93
- 'getTemplateLock'
94
- );
69
+ export const validateBlocksToTemplate = ( blocks ) => ( {
70
+ select,
71
+ dispatch,
72
+ } ) => {
73
+ const template = select.getTemplate();
74
+ const templateLock = select.getTemplateLock();
95
75
 
96
76
  // Unlocked templates are considered always valid because they act
97
77
  // as default values only.
@@ -101,16 +81,13 @@ export function* validateBlocksToTemplate( blocks ) {
101
81
  doBlocksMatchTemplate( blocks, template );
102
82
 
103
83
  // Update if validity has changed.
104
- const isValidTemplate = yield controls.select(
105
- blockEditorStoreName,
106
- 'isValidTemplate'
107
- );
84
+ const isValidTemplate = select.isValidTemplate();
108
85
 
109
86
  if ( isBlocksValidToTemplate !== isValidTemplate ) {
110
- yield setTemplateValidity( isBlocksValidToTemplate );
87
+ dispatch.setTemplateValidity( isBlocksValidToTemplate );
111
88
  return isBlocksValidToTemplate;
112
89
  }
113
- }
90
+ };
114
91
 
115
92
  /**
116
93
  * A block selection object.
@@ -123,6 +100,7 @@ export function* validateBlocksToTemplate( blocks ) {
123
100
  * text value. See `wp.richText.create`.
124
101
  */
125
102
 
103
+ /* eslint-disable jsdoc/valid-types */
126
104
  /**
127
105
  * Returns an action object used in signalling that selection state should be
128
106
  * reset to the specified selection.
@@ -138,6 +116,7 @@ export function resetSelection(
138
116
  selectionEnd,
139
117
  initialPosition
140
118
  ) {
119
+ /* eslint-enable jsdoc/valid-types */
141
120
  return {
142
121
  type: 'RESET_SELECTION',
143
122
  selectionStart,
@@ -170,8 +149,7 @@ export function receiveBlocks( blocks ) {
170
149
  }
171
150
 
172
151
  /**
173
- * Returns an action object used in signalling that the multiple blocks'
174
- * attributes with the specified client IDs have been updated.
152
+ * Action that updates attributes of multiple blocks with the specified client IDs.
175
153
  *
176
154
  * @param {string|string[]} clientIds Block client IDs.
177
155
  * @param {Object} attributes Block attributes to be merged. Should be keyed by clientIds if
@@ -193,8 +171,7 @@ export function updateBlockAttributes(
193
171
  }
194
172
 
195
173
  /**
196
- * Returns an action object used in signalling that the block with the
197
- * specified client ID has been updated.
174
+ * Action that updates the block with the specified client ID.
198
175
  *
199
176
  * @param {string} clientId Block client ID.
200
177
  * @param {Object} updates Block attributes to be merged.
@@ -209,6 +186,7 @@ export function updateBlock( clientId, updates ) {
209
186
  };
210
187
  }
211
188
 
189
+ /* eslint-disable jsdoc/valid-types */
212
190
  /**
213
191
  * Returns an action object used in signalling that the block with the
214
192
  * specified client ID has been selected, optionally accepting a position
@@ -222,6 +200,7 @@ export function updateBlock( clientId, updates ) {
222
200
  * @return {Object} Action object.
223
201
  */
224
202
  export function selectBlock( clientId, initialPosition = 0 ) {
203
+ /* eslint-enable jsdoc/valid-types */
225
204
  return {
226
205
  type: 'SELECT_BLOCK',
227
206
  initialPosition,
@@ -235,18 +214,12 @@ export function selectBlock( clientId, initialPosition = 0 ) {
235
214
  *
236
215
  * @param {string} clientId Block client ID.
237
216
  */
238
- export function* selectPreviousBlock( clientId ) {
239
- const previousBlockClientId = yield controls.select(
240
- blockEditorStoreName,
241
- 'getPreviousBlockClientId',
242
- clientId
243
- );
244
-
217
+ export const selectPreviousBlock = ( clientId ) => ( { select, dispatch } ) => {
218
+ const previousBlockClientId = select.getPreviousBlockClientId( clientId );
245
219
  if ( previousBlockClientId ) {
246
- yield selectBlock( previousBlockClientId, -1 );
247
- return [ previousBlockClientId ];
220
+ dispatch.selectBlock( previousBlockClientId, -1 );
248
221
  }
249
- }
222
+ };
250
223
 
251
224
  /**
252
225
  * Yields action objects used in signalling that the block following the given
@@ -254,21 +227,15 @@ export function* selectPreviousBlock( clientId ) {
254
227
  *
255
228
  * @param {string} clientId Block client ID.
256
229
  */
257
- export function* selectNextBlock( clientId ) {
258
- const nextBlockClientId = yield controls.select(
259
- blockEditorStoreName,
260
- 'getNextBlockClientId',
261
- clientId
262
- );
263
-
230
+ export const selectNextBlock = ( clientId ) => ( { select, dispatch } ) => {
231
+ const nextBlockClientId = select.getNextBlockClientId( clientId );
264
232
  if ( nextBlockClientId ) {
265
- yield selectBlock( nextBlockClientId );
266
- return [ nextBlockClientId ];
233
+ dispatch.selectBlock( nextBlockClientId );
267
234
  }
268
- }
235
+ };
269
236
 
270
237
  /**
271
- * Returns an action object used in signalling that a block multi-selection has started.
238
+ * Action that starts block multi-selection.
272
239
  *
273
240
  * @return {Object} Action object.
274
241
  */
@@ -279,7 +246,7 @@ export function startMultiSelect() {
279
246
  }
280
247
 
281
248
  /**
282
- * Returns an action object used in signalling that block multi-selection stopped.
249
+ * Action that stops block multi-selection.
283
250
  *
284
251
  * @return {Object} Action object.
285
252
  */
@@ -290,38 +257,23 @@ export function stopMultiSelect() {
290
257
  }
291
258
 
292
259
  /**
293
- * Returns an action object used in signalling that block multi-selection changed.
260
+ * Action that changes block multi-selection.
294
261
  *
295
262
  * @param {string} start First block of the multi selection.
296
263
  * @param {string} end Last block of the multiselection.
297
264
  */
298
- export function* multiSelect( start, end ) {
299
- const startBlockRootClientId = yield controls.select(
300
- blockEditorStoreName,
301
- 'getBlockRootClientId',
302
- start
303
- );
304
- const endBlockRootClientId = yield controls.select(
305
- blockEditorStoreName,
306
- 'getBlockRootClientId',
307
- end
308
- );
265
+ export const multiSelect = ( start, end ) => ( { select, dispatch } ) => {
266
+ const startBlockRootClientId = select.getBlockRootClientId( start );
267
+ const endBlockRootClientId = select.getBlockRootClientId( end );
309
268
 
310
269
  // Only allow block multi-selections at the same level.
311
270
  if ( startBlockRootClientId !== endBlockRootClientId ) {
312
271
  return;
313
272
  }
314
273
 
315
- yield {
316
- type: 'MULTI_SELECT',
317
- start,
318
- end,
319
- };
274
+ dispatch( { type: 'MULTI_SELECT', start, end } );
320
275
 
321
- const blockCount = yield controls.select(
322
- blockEditorStoreName,
323
- 'getSelectedBlockCount'
324
- );
276
+ const blockCount = select.getSelectedBlockCount();
325
277
 
326
278
  speak(
327
279
  sprintf(
@@ -331,10 +283,10 @@ export function* multiSelect( start, end ) {
331
283
  ),
332
284
  'assertive'
333
285
  );
334
- }
286
+ };
335
287
 
336
288
  /**
337
- * Returns an action object used in signalling that the block selection is cleared.
289
+ * Action that clears the block selection.
338
290
  *
339
291
  * @return {Object} Action object.
340
292
  */
@@ -345,7 +297,7 @@ export function clearSelectedBlock() {
345
297
  }
346
298
 
347
299
  /**
348
- * Returns an action object that enables or disables block selection.
300
+ * Action that enables or disables block selection.
349
301
  *
350
302
  * @param {boolean} [isSelectionEnabled=true] Whether block selection should
351
303
  * be enabled.
@@ -389,9 +341,9 @@ function getBlocksWithDefaultStylesApplied( blocks, blockEditorSettings ) {
389
341
  } );
390
342
  }
391
343
 
344
+ /* eslint-disable jsdoc/valid-types */
392
345
  /**
393
- * Returns an action object signalling that a blocks should be replaced with
394
- * one or more replacement blocks.
346
+ * Action that replaces given blocks with one or more replacement blocks.
395
347
  *
396
348
  * @param {(string|string[])} clientIds Block client ID(s) to replace.
397
349
  * @param {(Object|Object[])} blocks Replacement block(s).
@@ -399,31 +351,26 @@ function getBlocksWithDefaultStylesApplied( blocks, blockEditorSettings ) {
399
351
  * @param {0|-1|null} initialPosition Index of caret after in the selected block after the operation.
400
352
  * @param {?Object} meta Optional Meta values to be passed to the action object.
401
353
  *
402
- * @yield {Object} Action object.
354
+ * @return {Object} Action object.
403
355
  */
404
- export function* replaceBlocks(
356
+ export const replaceBlocks = (
405
357
  clientIds,
406
358
  blocks,
407
359
  indexToSelect,
408
360
  initialPosition = 0,
409
361
  meta
410
- ) {
362
+ ) => ( { select, dispatch } ) => {
363
+ /* eslint-enable jsdoc/valid-types */
411
364
  clientIds = castArray( clientIds );
412
365
  blocks = getBlocksWithDefaultStylesApplied(
413
366
  castArray( blocks ),
414
- yield controls.select( blockEditorStoreName, 'getSettings' )
415
- );
416
- const rootClientId = yield controls.select(
417
- blockEditorStoreName,
418
- 'getBlockRootClientId',
419
- first( clientIds )
367
+ select.getSettings()
420
368
  );
369
+ const rootClientId = select.getBlockRootClientId( first( clientIds ) );
421
370
  // Replace is valid if the new blocks can be inserted in the root block.
422
371
  for ( let index = 0; index < blocks.length; index++ ) {
423
372
  const block = blocks[ index ];
424
- const canInsertBlock = yield controls.select(
425
- blockEditorStoreName,
426
- 'canInsertBlockType',
373
+ const canInsertBlock = select.canInsertBlockType(
427
374
  block.name,
428
375
  rootClientId
429
376
  );
@@ -431,7 +378,7 @@ export function* replaceBlocks(
431
378
  return;
432
379
  }
433
380
  }
434
- yield {
381
+ dispatch( {
435
382
  type: 'REPLACE_BLOCKS',
436
383
  clientIds,
437
384
  blocks,
@@ -439,13 +386,12 @@ export function* replaceBlocks(
439
386
  indexToSelect,
440
387
  initialPosition,
441
388
  meta,
442
- };
443
- yield* ensureDefaultBlock();
444
- }
389
+ } );
390
+ dispatch( ensureDefaultBlock() );
391
+ };
445
392
 
446
393
  /**
447
- * Returns an action object signalling that a single block should be replaced
448
- * with one or more replacement blocks.
394
+ * Action that replaces a single block with one or more replacement blocks.
449
395
  *
450
396
  * @param {(string|string[])} clientId Block client ID to replace.
451
397
  * @param {(Object|Object[])} block Replacement block(s).
@@ -464,100 +410,91 @@ export function replaceBlock( clientId, block ) {
464
410
  *
465
411
  * @return {Function} Action creator.
466
412
  */
467
- function createOnMove( type ) {
468
- return ( clientIds, rootClientId ) => {
469
- return {
470
- clientIds: castArray( clientIds ),
471
- type,
472
- rootClientId,
473
- };
474
- };
475
- }
413
+ const createOnMove = ( type ) => ( clientIds, rootClientId ) => ( {
414
+ select,
415
+ dispatch,
416
+ } ) => {
417
+ // If one of the blocks is locked or the parent is locked, we cannot move any block.
418
+ const canMoveBlocks = select.canMoveBlocks( clientIds, rootClientId );
419
+ if ( ! canMoveBlocks ) {
420
+ return;
421
+ }
422
+
423
+ dispatch( { type, clientIds: castArray( clientIds ), rootClientId } );
424
+ };
476
425
 
477
426
  export const moveBlocksDown = createOnMove( 'MOVE_BLOCKS_DOWN' );
478
427
  export const moveBlocksUp = createOnMove( 'MOVE_BLOCKS_UP' );
479
428
 
480
429
  /**
481
- * Returns an action object signalling that the given blocks should be moved to
482
- * a new position.
430
+ * Action that moves given blocks to a new position.
483
431
  *
484
432
  * @param {?string} clientIds The client IDs of the blocks.
485
433
  * @param {?string} fromRootClientId Root client ID source.
486
434
  * @param {?string} toRootClientId Root client ID destination.
487
435
  * @param {number} index The index to move the blocks to.
488
- *
489
- * @yield {Object} Action object.
490
436
  */
491
- export function* moveBlocksToPosition(
437
+ export const moveBlocksToPosition = (
492
438
  clientIds,
493
439
  fromRootClientId = '',
494
440
  toRootClientId = '',
495
441
  index
496
- ) {
497
- const templateLock = yield controls.select(
498
- blockEditorStoreName,
499
- 'getTemplateLock',
500
- fromRootClientId
501
- );
442
+ ) => ( { select, dispatch } ) => {
443
+ const canMoveBlocks = select.canMoveBlocks( clientIds, fromRootClientId );
502
444
 
503
- // If locking is equal to all on the original clientId (fromRootClientId),
504
- // it is not possible to move the block to any other position.
505
- if ( templateLock === 'all' ) {
445
+ // If one of the blocks is locked or the parent is locked, we cannot move any block.
446
+ if ( ! canMoveBlocks ) {
506
447
  return;
507
448
  }
508
449
 
509
- const action = {
510
- type: 'MOVE_BLOCKS_TO_POSITION',
511
- fromRootClientId,
512
- toRootClientId,
513
- clientIds,
514
- index,
515
- };
516
-
517
450
  // If moving inside the same root block the move is always possible.
518
- if ( fromRootClientId === toRootClientId ) {
519
- yield action;
520
- return;
521
- }
451
+ if ( fromRootClientId !== toRootClientId ) {
452
+ const canRemoveBlocks = select.canRemoveBlocks(
453
+ clientIds,
454
+ fromRootClientId
455
+ );
522
456
 
523
- // If templateLock is insert we can not remove the block from the parent.
524
- // Given that here we know that we are moving the block to a different
525
- // parent, the move should not be possible if the condition is true.
526
- if ( templateLock === 'insert' ) {
527
- return;
528
- }
457
+ // If we're moving to another block, it means we're deleting blocks from
458
+ // the original block, so we need to check if removing is possible.
459
+ if ( ! canRemoveBlocks ) {
460
+ return;
461
+ }
529
462
 
530
- const canInsertBlocks = yield controls.select(
531
- blockEditorStoreName,
532
- 'canInsertBlocks',
533
- clientIds,
534
- toRootClientId
535
- );
463
+ const canInsertBlocks = select.canInsertBlocks(
464
+ clientIds,
465
+ toRootClientId
466
+ );
536
467
 
537
- // If moving to other parent block, the move is possible if we can insert a block of the same type inside the new parent block.
538
- if ( canInsertBlocks ) {
539
- yield action;
468
+ // If moving to other parent block, the move is possible if we can insert a block of the same type inside the new parent block.
469
+ if ( ! canInsertBlocks ) {
470
+ return;
471
+ }
540
472
  }
541
- }
473
+
474
+ dispatch( {
475
+ type: 'MOVE_BLOCKS_TO_POSITION',
476
+ fromRootClientId,
477
+ toRootClientId,
478
+ clientIds,
479
+ index,
480
+ } );
481
+ };
542
482
 
543
483
  /**
544
- * Returns an action object signalling that the given block should be moved to a
545
- * new position.
484
+ * Action that moves given block to a new position.
546
485
  *
547
486
  * @param {?string} clientId The client ID of the block.
548
487
  * @param {?string} fromRootClientId Root client ID source.
549
488
  * @param {?string} toRootClientId Root client ID destination.
550
489
  * @param {number} index The index to move the block to.
551
- *
552
- * @yield {Object} Action object.
553
490
  */
554
- export function* moveBlockToPosition(
491
+ export function moveBlockToPosition(
555
492
  clientId,
556
493
  fromRootClientId = '',
557
494
  toRootClientId = '',
558
495
  index
559
496
  ) {
560
- yield moveBlocksToPosition(
497
+ return moveBlocksToPosition(
561
498
  [ clientId ],
562
499
  fromRootClientId,
563
500
  toRootClientId,
@@ -566,8 +503,7 @@ export function* moveBlockToPosition(
566
503
  }
567
504
 
568
505
  /**
569
- * Returns an action object used in signalling that a single block should be
570
- * inserted, optionally at a specific index respective a root block list.
506
+ * Action that inserts a single block, optionally at a specific index respective a root block list.
571
507
  *
572
508
  * @param {Object} block Block object to insert.
573
509
  * @param {?number} index Index at which block should be inserted.
@@ -581,7 +517,7 @@ export function insertBlock(
581
517
  block,
582
518
  index,
583
519
  rootClientId,
584
- updateSelection = true,
520
+ updateSelection,
585
521
  meta
586
522
  ) {
587
523
  return insertBlocks(
@@ -594,9 +530,9 @@ export function insertBlock(
594
530
  );
595
531
  }
596
532
 
533
+ /* eslint-disable jsdoc/valid-types */
597
534
  /**
598
- * Returns an action object used in signalling that an array of blocks should
599
- * be inserted, optionally at a specific index respective a root block list.
535
+ * Action that inserts an array of blocks, optionally at a specific index respective a root block list.
600
536
  *
601
537
  * @param {Object[]} blocks Block objects to insert.
602
538
  * @param {?number} index Index at which block should be inserted.
@@ -606,14 +542,15 @@ export function insertBlock(
606
542
  * @param {?Object} meta Optional Meta values to be passed to the action object.
607
543
  * @return {Object} Action object.
608
544
  */
609
- export function* insertBlocks(
545
+ export const insertBlocks = (
610
546
  blocks,
611
547
  index,
612
548
  rootClientId,
613
549
  updateSelection = true,
614
550
  initialPosition = 0,
615
551
  meta
616
- ) {
552
+ ) => ( { select, dispatch } ) => {
553
+ /* eslint-enable jsdoc/valid-types */
617
554
  if ( isObject( initialPosition ) ) {
618
555
  meta = initialPosition;
619
556
  initialPosition = 0;
@@ -626,22 +563,17 @@ export function* insertBlocks(
626
563
 
627
564
  blocks = getBlocksWithDefaultStylesApplied(
628
565
  castArray( blocks ),
629
- yield controls.select( blockEditorStoreName, 'getSettings' )
566
+ select.getSettings()
630
567
  );
631
568
  const allowedBlocks = [];
632
569
  for ( const block of blocks ) {
633
- const isValid = yield controls.select(
634
- blockEditorStoreName,
635
- 'canInsertBlockType',
636
- block.name,
637
- rootClientId
638
- );
570
+ const isValid = select.canInsertBlockType( block.name, rootClientId );
639
571
  if ( isValid ) {
640
572
  allowedBlocks.push( block );
641
573
  }
642
574
  }
643
575
  if ( allowedBlocks.length ) {
644
- return {
576
+ dispatch( {
645
577
  type: 'INSERT_BLOCKS',
646
578
  blocks: allowedBlocks,
647
579
  index,
@@ -650,13 +582,12 @@ export function* insertBlocks(
650
582
  updateSelection,
651
583
  initialPosition: updateSelection ? initialPosition : null,
652
584
  meta,
653
- };
585
+ } );
654
586
  }
655
- }
587
+ };
656
588
 
657
589
  /**
658
- * Returns an action object used in signalling that the insertion point should
659
- * be shown.
590
+ * Action that shows the insertion point.
660
591
  *
661
592
  * @param {?string} rootClientId Optional root client ID of block list on
662
593
  * which to insert.
@@ -680,7 +611,7 @@ export function showInsertionPoint(
680
611
  }
681
612
 
682
613
  /**
683
- * Returns an action object hiding the insertion point.
614
+ * Action that hides the insertion point.
684
615
  *
685
616
  * @return {Object} Action object.
686
617
  */
@@ -691,7 +622,7 @@ export function hideInsertionPoint() {
691
622
  }
692
623
 
693
624
  /**
694
- * Returns an action object resetting the template validity.
625
+ * Action that resets the template validity.
695
626
  *
696
627
  * @param {boolean} isValid template validity flag.
697
628
  *
@@ -705,61 +636,45 @@ export function setTemplateValidity( isValid ) {
705
636
  }
706
637
 
707
638
  /**
708
- * Returns an action object synchronize the template with the list of blocks
639
+ * Action that synchronizes the template with the list of blocks.
709
640
  *
710
641
  * @return {Object} Action object.
711
642
  */
712
- export function* synchronizeTemplate() {
713
- yield {
714
- type: 'SYNCHRONIZE_TEMPLATE',
715
- };
716
- const blocks = yield controls.select( blockEditorStoreName, 'getBlocks' );
717
- const template = yield controls.select(
718
- blockEditorStoreName,
719
- 'getTemplate'
720
- );
643
+ export const synchronizeTemplate = () => ( { select, dispatch } ) => {
644
+ dispatch( { type: 'SYNCHRONIZE_TEMPLATE' } );
645
+ const blocks = select.getBlocks();
646
+ const template = select.getTemplate();
721
647
  const updatedBlockList = synchronizeBlocksWithTemplate( blocks, template );
722
648
 
723
- return yield resetBlocks( updatedBlockList );
724
- }
649
+ dispatch.resetBlocks( updatedBlockList );
650
+ };
725
651
 
726
652
  /**
727
- * Returns an action object used in signalling that two blocks should be merged
653
+ * Action that merges two blocks.
728
654
  *
729
655
  * @param {string} firstBlockClientId Client ID of the first block to merge.
730
656
  * @param {string} secondBlockClientId Client ID of the second block to merge.
731
657
  */
732
- export function* mergeBlocks( firstBlockClientId, secondBlockClientId ) {
658
+ export const mergeBlocks = ( firstBlockClientId, secondBlockClientId ) => ( {
659
+ select,
660
+ dispatch,
661
+ } ) => {
733
662
  const blocks = [ firstBlockClientId, secondBlockClientId ];
734
- yield {
735
- type: 'MERGE_BLOCKS',
736
- blocks,
737
- };
663
+ dispatch( { type: 'MERGE_BLOCKS', blocks } );
738
664
 
739
665
  const [ clientIdA, clientIdB ] = blocks;
740
- const blockA = yield controls.select(
741
- blockEditorStoreName,
742
- 'getBlock',
743
- clientIdA
744
- );
666
+ const blockA = select.getBlock( clientIdA );
745
667
  const blockAType = getBlockType( blockA.name );
746
668
 
747
669
  // Only focus the previous block if it's not mergeable
748
- if ( ! blockAType.merge ) {
749
- yield selectBlock( blockA.clientId );
670
+ if ( blockAType && ! blockAType.merge ) {
671
+ dispatch.selectBlock( blockA.clientId );
750
672
  return;
751
673
  }
752
674
 
753
- const blockB = yield controls.select(
754
- blockEditorStoreName,
755
- 'getBlock',
756
- clientIdB
757
- );
675
+ const blockB = select.getBlock( clientIdB );
758
676
  const blockBType = getBlockType( blockB.name );
759
- const { clientId, attributeKey, offset } = yield controls.select(
760
- blockEditorStoreName,
761
- 'getSelectionStart'
762
- );
677
+ const { clientId, attributeKey, offset } = select.getSelectionStart();
763
678
  const selectedBlockType = clientId === clientIdA ? blockAType : blockBType;
764
679
  const attributeDefinition = selectedBlockType.attributes[ attributeKey ];
765
680
  const canRestoreTextSelection =
@@ -866,7 +781,7 @@ export function* mergeBlocks( firstBlockClientId, secondBlockClientId ) {
866
781
 
867
782
  updatedAttributes[ newAttributeKey ] = newHtml;
868
783
 
869
- yield selectionChange(
784
+ dispatch.selectionChange(
870
785
  blockA.clientId,
871
786
  newAttributeKey,
872
787
  newOffset,
@@ -874,7 +789,7 @@ export function* mergeBlocks( firstBlockClientId, secondBlockClientId ) {
874
789
  );
875
790
  }
876
791
 
877
- yield* replaceBlocks(
792
+ dispatch.replaceBlocks(
878
793
  [ blockA.clientId, blockB.clientId ],
879
794
  [
880
795
  {
@@ -888,7 +803,7 @@ export function* mergeBlocks( firstBlockClientId, secondBlockClientId ) {
888
803
  ],
889
804
  0 // If we don't pass the `indexToSelect` it will default to the last block.
890
805
  );
891
- }
806
+ };
892
807
 
893
808
  /**
894
809
  * Yields action objects used in signalling that the blocks corresponding to
@@ -898,47 +813,32 @@ export function* mergeBlocks( firstBlockClientId, secondBlockClientId ) {
898
813
  * @param {boolean} selectPrevious True if the previous block should be
899
814
  * selected when a block is removed.
900
815
  */
901
- export function* removeBlocks( clientIds, selectPrevious = true ) {
816
+ export const removeBlocks = ( clientIds, selectPrevious = true ) => ( {
817
+ select,
818
+ dispatch,
819
+ } ) => {
902
820
  if ( ! clientIds || ! clientIds.length ) {
903
821
  return;
904
822
  }
905
823
 
906
824
  clientIds = castArray( clientIds );
907
- const rootClientId = yield controls.select(
908
- blockEditorStoreName,
909
- 'getBlockRootClientId',
910
- clientIds[ 0 ]
911
- );
912
- const isLocked = yield controls.select(
913
- blockEditorStoreName,
914
- 'getTemplateLock',
915
- rootClientId
916
- );
917
- if ( isLocked ) {
825
+ const rootClientId = select.getBlockRootClientId( clientIds[ 0 ] );
826
+ const canRemoveBlocks = select.canRemoveBlocks( clientIds, rootClientId );
827
+
828
+ if ( ! canRemoveBlocks ) {
918
829
  return;
919
830
  }
920
831
 
921
- let previousBlockId;
922
832
  if ( selectPrevious ) {
923
- previousBlockId = yield selectPreviousBlock( clientIds[ 0 ] );
924
- } else {
925
- previousBlockId = yield controls.select(
926
- blockEditorStoreName,
927
- 'getPreviousBlockClientId',
928
- clientIds[ 0 ]
929
- );
833
+ dispatch.selectPreviousBlock( clientIds[ 0 ] );
930
834
  }
931
835
 
932
- yield {
933
- type: 'REMOVE_BLOCKS',
934
- clientIds,
935
- };
836
+ dispatch( { type: 'REMOVE_BLOCKS', clientIds } );
936
837
 
937
838
  // To avoid a focus loss when removing the last block, assure there is
938
839
  // always a default block if the last of the blocks have been removed.
939
- const defaultBlockId = yield* ensureDefaultBlock();
940
- return [ previousBlockId || defaultBlockId ];
941
- }
840
+ dispatch( ensureDefaultBlock() );
841
+ };
942
842
 
943
843
  /**
944
844
  * Returns an action object used in signalling that the block with the
@@ -954,6 +854,7 @@ export function removeBlock( clientId, selectPrevious ) {
954
854
  return removeBlocks( [ clientId ], selectPrevious );
955
855
  }
956
856
 
857
+ /* eslint-disable jsdoc/valid-types */
957
858
  /**
958
859
  * Returns an action object used in signalling that the inner blocks with the
959
860
  * specified client ID should be replaced.
@@ -970,6 +871,7 @@ export function replaceInnerBlocks(
970
871
  updateSelection = false,
971
872
  initialPosition = 0
972
873
  ) {
874
+ /* eslint-enable jsdoc/valid-types */
973
875
  return {
974
876
  type: 'REPLACE_INNER_BLOCKS',
975
877
  rootClientId,
@@ -1065,8 +967,7 @@ export function exitFormattedText() {
1065
967
  }
1066
968
 
1067
969
  /**
1068
- * Returns an action object used in signalling that the user caret has changed
1069
- * position.
970
+ * Action that changes the position of the user caret.
1070
971
  *
1071
972
  * @param {string} clientId The selected block client ID.
1072
973
  * @param {string} attributeKey The selected block attribute key.
@@ -1091,8 +992,7 @@ export function selectionChange(
1091
992
  }
1092
993
 
1093
994
  /**
1094
- * Returns an action object used in signalling that a new block of the default
1095
- * type should be added to the block list.
995
+ * Action that adds a new block of the default type to the block list.
1096
996
  *
1097
997
  * @param {?Object} attributes Optional attributes of the block to assign.
1098
998
  * @param {?string} rootClientId Optional root client ID of block list on which
@@ -1114,7 +1014,7 @@ export function insertDefaultBlock( attributes, rootClientId, index ) {
1114
1014
  }
1115
1015
 
1116
1016
  /**
1117
- * Returns an action object that changes the nested settings of a given block.
1017
+ * Action that changes the nested settings of a given block.
1118
1018
  *
1119
1019
  * @param {string} clientId Client ID of the block whose nested setting are
1120
1020
  * being received.
@@ -1131,7 +1031,7 @@ export function updateBlockListSettings( clientId, settings ) {
1131
1031
  }
1132
1032
 
1133
1033
  /**
1134
- * Returns an action object used in signalling that the block editor settings have been updated.
1034
+ * Action that updates the block editor settings.
1135
1035
  *
1136
1036
  * @param {Object} settings Updated settings
1137
1037
  *
@@ -1145,7 +1045,7 @@ export function updateSettings( settings ) {
1145
1045
  }
1146
1046
 
1147
1047
  /**
1148
- * Returns an action object used in signalling that a temporary reusable blocks have been saved
1048
+ * Action that signals that a temporary reusable block has been saved
1149
1049
  * in order to switch its temporary id with the real id.
1150
1050
  *
1151
1051
  * @param {string} id Reusable block's id.
@@ -1162,7 +1062,7 @@ export function __unstableSaveReusableBlock( id, updatedId ) {
1162
1062
  }
1163
1063
 
1164
1064
  /**
1165
- * Returns an action object used in signalling that the last block change should be marked explicitly as persistent.
1065
+ * Action that marks the last block change explicitly as persistent.
1166
1066
  *
1167
1067
  * @return {Object} Action object.
1168
1068
  */
@@ -1171,7 +1071,7 @@ export function __unstableMarkLastChangeAsPersistent() {
1171
1071
  }
1172
1072
 
1173
1073
  /**
1174
- * Returns an action object used in signalling that the next block change should be marked explicitly as not persistent.
1074
+ * Action that signals that the next block change should be marked explicitly as not persistent.
1175
1075
  *
1176
1076
  * @return {Object} Action object.
1177
1077
  */
@@ -1180,34 +1080,29 @@ export function __unstableMarkNextChangeAsNotPersistent() {
1180
1080
  }
1181
1081
 
1182
1082
  /**
1183
- * Returns an action object used in signalling that the last block change is
1184
- * an automatic change, meaning it was not performed by the user, and can be
1185
- * undone using the `Escape` and `Backspace` keys. This action must be called
1186
- * after the change was made, and any actions that are a consequence of it, so
1187
- * it is recommended to be called at the next idle period to ensure all
1083
+ * Action that marks the last block change as an automatic change, meaning it was not
1084
+ * performed by the user, and can be undone using the `Escape` and `Backspace` keys.
1085
+ * This action must be called after the change was made, and any actions that are a
1086
+ * consequence of it, so it is recommended to be called at the next idle period to ensure all
1188
1087
  * selection changes have been recorded.
1189
1088
  */
1190
- export function* __unstableMarkAutomaticChange() {
1191
- yield { type: 'MARK_AUTOMATIC_CHANGE' };
1192
- yield __unstableMarkAutomaticChangeFinalControl();
1193
- }
1194
-
1195
- export function __unstableMarkAutomaticChangeFinal() {
1196
- return {
1197
- type: 'MARK_AUTOMATIC_CHANGE_FINAL',
1198
- };
1199
- }
1089
+ export const __unstableMarkAutomaticChange = () => ( { dispatch } ) => {
1090
+ dispatch( { type: 'MARK_AUTOMATIC_CHANGE' } );
1091
+ const { requestIdleCallback = ( cb ) => setTimeout( cb, 100 ) } = window;
1092
+ requestIdleCallback( () => {
1093
+ dispatch( { type: 'MARK_AUTOMATIC_CHANGE_FINAL' } );
1094
+ } );
1095
+ };
1200
1096
 
1201
1097
  /**
1202
- * Generators that triggers an action used to enable or disable the navigation mode.
1098
+ * Action that enables or disables the navigation mode.
1203
1099
  *
1204
1100
  * @param {string} isNavigationMode Enable/Disable navigation mode.
1205
1101
  */
1206
- export function* setNavigationMode( isNavigationMode = true ) {
1207
- yield {
1208
- type: 'SET_NAVIGATION_MODE',
1209
- isNavigationMode,
1210
- };
1102
+ export const setNavigationMode = ( isNavigationMode = true ) => ( {
1103
+ dispatch,
1104
+ } ) => {
1105
+ dispatch( { type: 'SET_NAVIGATION_MODE', isNavigationMode } );
1211
1106
 
1212
1107
  if ( isNavigationMode ) {
1213
1108
  speak(
@@ -1222,18 +1117,17 @@ export function* setNavigationMode( isNavigationMode = true ) {
1222
1117
  )
1223
1118
  );
1224
1119
  }
1225
- }
1120
+ };
1226
1121
 
1227
1122
  /**
1228
- * Generator that triggers an action used to enable or disable the block moving mode.
1123
+ * Action that enables or disables the block moving mode.
1229
1124
  *
1230
1125
  * @param {string|null} hasBlockMovingClientId Enable/Disable block moving mode.
1231
1126
  */
1232
- export function* setBlockMovingClientId( hasBlockMovingClientId = null ) {
1233
- yield {
1234
- type: 'SET_BLOCK_MOVING_MODE',
1235
- hasBlockMovingClientId,
1236
- };
1127
+ export const setBlockMovingClientId = ( hasBlockMovingClientId = null ) => ( {
1128
+ dispatch,
1129
+ } ) => {
1130
+ dispatch( { type: 'SET_BLOCK_MOVING_MODE', hasBlockMovingClientId } );
1237
1131
 
1238
1132
  if ( hasBlockMovingClientId ) {
1239
1133
  speak(
@@ -1242,133 +1136,105 @@ export function* setBlockMovingClientId( hasBlockMovingClientId = null ) {
1242
1136
  )
1243
1137
  );
1244
1138
  }
1245
- }
1139
+ };
1246
1140
 
1247
1141
  /**
1248
- * Generator that triggers an action used to duplicate a list of blocks.
1142
+ * Action that duplicates a list of blocks.
1249
1143
  *
1250
1144
  * @param {string[]} clientIds
1251
1145
  * @param {boolean} updateSelection
1252
1146
  */
1253
- export function* duplicateBlocks( clientIds, updateSelection = true ) {
1254
- if ( ! clientIds && ! clientIds.length ) {
1147
+ export const duplicateBlocks = ( clientIds, updateSelection = true ) => ( {
1148
+ select,
1149
+ dispatch,
1150
+ } ) => {
1151
+ if ( ! clientIds || ! clientIds.length ) {
1255
1152
  return;
1256
1153
  }
1257
- const blocks = yield controls.select(
1258
- blockEditorStoreName,
1259
- 'getBlocksByClientId',
1260
- clientIds
1261
- );
1262
- const rootClientId = yield controls.select(
1263
- blockEditorStoreName,
1264
- 'getBlockRootClientId',
1265
- clientIds[ 0 ]
1266
- );
1154
+
1267
1155
  // Return early if blocks don't exist.
1156
+ const blocks = select.getBlocksByClientId( clientIds );
1268
1157
  if ( some( blocks, ( block ) => ! block ) ) {
1269
1158
  return;
1270
1159
  }
1271
- const blockNames = blocks.map( ( block ) => block.name );
1160
+
1272
1161
  // Return early if blocks don't support multiple usage.
1162
+ const blockNames = blocks.map( ( block ) => block.name );
1273
1163
  if (
1274
- some(
1275
- blockNames,
1164
+ blockNames.some(
1276
1165
  ( blockName ) => ! hasBlockSupport( blockName, 'multiple', true )
1277
1166
  )
1278
1167
  ) {
1279
1168
  return;
1280
1169
  }
1281
1170
 
1282
- const lastSelectedIndex = yield controls.select(
1283
- blockEditorStoreName,
1284
- 'getBlockIndex',
1171
+ const rootClientId = select.getBlockRootClientId( clientIds[ 0 ] );
1172
+ const lastSelectedIndex = select.getBlockIndex(
1285
1173
  last( castArray( clientIds ) ),
1286
1174
  rootClientId
1287
1175
  );
1288
1176
  const clonedBlocks = blocks.map( ( block ) =>
1289
1177
  __experimentalCloneSanitizedBlock( block )
1290
1178
  );
1291
- yield insertBlocks(
1179
+ dispatch.insertBlocks(
1292
1180
  clonedBlocks,
1293
1181
  lastSelectedIndex + 1,
1294
1182
  rootClientId,
1295
1183
  updateSelection
1296
1184
  );
1297
1185
  if ( clonedBlocks.length > 1 && updateSelection ) {
1298
- yield multiSelect(
1186
+ dispatch.multiSelect(
1299
1187
  first( clonedBlocks ).clientId,
1300
1188
  last( clonedBlocks ).clientId
1301
1189
  );
1302
1190
  }
1303
1191
  return clonedBlocks.map( ( block ) => block.clientId );
1304
- }
1192
+ };
1305
1193
 
1306
1194
  /**
1307
- * Generator used to insert an empty block after a given block.
1195
+ * Action that inserts an empty block before a given block.
1308
1196
  *
1309
1197
  * @param {string} clientId
1310
1198
  */
1311
- export function* insertBeforeBlock( clientId ) {
1199
+ export const insertBeforeBlock = ( clientId ) => ( { select, dispatch } ) => {
1312
1200
  if ( ! clientId ) {
1313
1201
  return;
1314
1202
  }
1315
- const rootClientId = yield controls.select(
1316
- blockEditorStoreName,
1317
- 'getBlockRootClientId',
1318
- clientId
1319
- );
1320
- const isLocked = yield controls.select(
1321
- blockEditorStoreName,
1322
- 'getTemplateLock',
1323
- rootClientId
1324
- );
1203
+ const rootClientId = select.getBlockRootClientId( clientId );
1204
+ const isLocked = select.getTemplateLock( rootClientId );
1325
1205
  if ( isLocked ) {
1326
1206
  return;
1327
1207
  }
1328
1208
 
1329
- const firstSelectedIndex = yield controls.select(
1330
- blockEditorStoreName,
1331
- 'getBlockIndex',
1332
- clientId,
1333
- rootClientId
1334
- );
1335
- return yield insertDefaultBlock( {}, rootClientId, firstSelectedIndex );
1336
- }
1209
+ const firstSelectedIndex = select.getBlockIndex( clientId, rootClientId );
1210
+ return dispatch.insertDefaultBlock( {}, rootClientId, firstSelectedIndex );
1211
+ };
1337
1212
 
1338
1213
  /**
1339
- * Generator used to insert an empty block before a given block.
1214
+ * Action that inserts an empty block after a given block.
1340
1215
  *
1341
1216
  * @param {string} clientId
1342
1217
  */
1343
- export function* insertAfterBlock( clientId ) {
1218
+ export const insertAfterBlock = ( clientId ) => ( { select, dispatch } ) => {
1344
1219
  if ( ! clientId ) {
1345
1220
  return;
1346
1221
  }
1347
- const rootClientId = yield controls.select(
1348
- blockEditorStoreName,
1349
- 'getBlockRootClientId',
1350
- clientId
1351
- );
1352
- const isLocked = yield controls.select(
1353
- blockEditorStoreName,
1354
- 'getTemplateLock',
1355
- rootClientId
1356
- );
1222
+ const rootClientId = select.getBlockRootClientId( clientId );
1223
+ const isLocked = select.getTemplateLock( rootClientId );
1357
1224
  if ( isLocked ) {
1358
1225
  return;
1359
1226
  }
1360
1227
 
1361
- const firstSelectedIndex = yield controls.select(
1362
- blockEditorStoreName,
1363
- 'getBlockIndex',
1364
- clientId,
1365
- rootClientId
1228
+ const firstSelectedIndex = select.getBlockIndex( clientId, rootClientId );
1229
+ return dispatch.insertDefaultBlock(
1230
+ {},
1231
+ rootClientId,
1232
+ firstSelectedIndex + 1
1366
1233
  );
1367
- return yield insertDefaultBlock( {}, rootClientId, firstSelectedIndex + 1 );
1368
- }
1234
+ };
1369
1235
 
1370
1236
  /**
1371
- * Returns an action object that toggles the highlighted block state.
1237
+ * Action that toggles the highlighted block state.
1372
1238
  *
1373
1239
  * @param {string} clientId The block's clientId.
1374
1240
  * @param {boolean} isHighlighted The highlight state.
@@ -1382,22 +1248,18 @@ export function toggleBlockHighlight( clientId, isHighlighted ) {
1382
1248
  }
1383
1249
 
1384
1250
  /**
1385
- * Yields action objects used in signalling that the block corresponding to the
1386
- * given clientId should appear to "flash" by rhythmically highlighting it.
1251
+ * Action that "flashes" the block with a given `clientId` by rhythmically highlighting it.
1387
1252
  *
1388
1253
  * @param {string} clientId Target block client ID.
1389
1254
  */
1390
- export function* flashBlock( clientId ) {
1391
- yield toggleBlockHighlight( clientId, true );
1392
- yield {
1393
- type: 'SLEEP',
1394
- duration: 150,
1395
- };
1396
- yield toggleBlockHighlight( clientId, false );
1397
- }
1255
+ export const flashBlock = ( clientId ) => async ( { dispatch } ) => {
1256
+ dispatch( toggleBlockHighlight( clientId, true ) );
1257
+ await new Promise( ( resolve ) => setTimeout( resolve, 150 ) );
1258
+ dispatch( toggleBlockHighlight( clientId, false ) );
1259
+ };
1398
1260
 
1399
1261
  /**
1400
- * Returns an action object that sets whether the block has controlled innerblocks.
1262
+ * Action that sets whether a block has controlled inner blocks.
1401
1263
  *
1402
1264
  * @param {string} clientId The block's clientId.
1403
1265
  * @param {boolean} hasControlledInnerBlocks True if the block's inner blocks are controlled.