@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
@@ -5,32 +5,21 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.resetBlocks = resetBlocks;
9
- exports.validateBlocksToTemplate = validateBlocksToTemplate;
10
8
  exports.resetSelection = resetSelection;
11
9
  exports.receiveBlocks = receiveBlocks;
12
10
  exports.updateBlockAttributes = updateBlockAttributes;
13
11
  exports.updateBlock = updateBlock;
14
12
  exports.selectBlock = selectBlock;
15
- exports.selectPreviousBlock = selectPreviousBlock;
16
- exports.selectNextBlock = selectNextBlock;
17
13
  exports.startMultiSelect = startMultiSelect;
18
14
  exports.stopMultiSelect = stopMultiSelect;
19
- exports.multiSelect = multiSelect;
20
15
  exports.clearSelectedBlock = clearSelectedBlock;
21
16
  exports.toggleSelection = toggleSelection;
22
- exports.replaceBlocks = replaceBlocks;
23
17
  exports.replaceBlock = replaceBlock;
24
- exports.moveBlocksToPosition = moveBlocksToPosition;
25
18
  exports.moveBlockToPosition = moveBlockToPosition;
26
19
  exports.insertBlock = insertBlock;
27
- exports.insertBlocks = insertBlocks;
28
20
  exports.showInsertionPoint = showInsertionPoint;
29
21
  exports.hideInsertionPoint = hideInsertionPoint;
30
22
  exports.setTemplateValidity = setTemplateValidity;
31
- exports.synchronizeTemplate = synchronizeTemplate;
32
- exports.mergeBlocks = mergeBlocks;
33
- exports.removeBlocks = removeBlocks;
34
23
  exports.removeBlock = removeBlock;
35
24
  exports.replaceInnerBlocks = replaceInnerBlocks;
36
25
  exports.toggleBlockMode = toggleBlockMode;
@@ -47,17 +36,9 @@ exports.updateSettings = updateSettings;
47
36
  exports.__unstableSaveReusableBlock = __unstableSaveReusableBlock;
48
37
  exports.__unstableMarkLastChangeAsPersistent = __unstableMarkLastChangeAsPersistent;
49
38
  exports.__unstableMarkNextChangeAsNotPersistent = __unstableMarkNextChangeAsNotPersistent;
50
- exports.__unstableMarkAutomaticChange = __unstableMarkAutomaticChange;
51
- exports.__unstableMarkAutomaticChangeFinal = __unstableMarkAutomaticChangeFinal;
52
- exports.setNavigationMode = setNavigationMode;
53
- exports.setBlockMovingClientId = setBlockMovingClientId;
54
- exports.duplicateBlocks = duplicateBlocks;
55
- exports.insertBeforeBlock = insertBeforeBlock;
56
- exports.insertAfterBlock = insertAfterBlock;
57
39
  exports.toggleBlockHighlight = toggleBlockHighlight;
58
- exports.flashBlock = flashBlock;
59
40
  exports.setHasControlledInnerBlocks = setHasControlledInnerBlocks;
60
- exports.moveBlocksUp = exports.moveBlocksDown = void 0;
41
+ exports.flashBlock = exports.insertAfterBlock = exports.insertBeforeBlock = exports.duplicateBlocks = exports.setBlockMovingClientId = exports.setNavigationMode = exports.__unstableMarkAutomaticChange = exports.removeBlocks = exports.mergeBlocks = exports.synchronizeTemplate = exports.insertBlocks = exports.moveBlocksToPosition = exports.moveBlocksUp = exports.moveBlocksDown = exports.replaceBlocks = exports.multiSelect = exports.selectNextBlock = exports.selectPreviousBlock = exports.validateBlocksToTemplate = exports.resetBlocks = void 0;
61
42
 
62
43
  var _lodash = require("lodash");
63
44
 
@@ -67,16 +48,10 @@ var _a11y = require("@wordpress/a11y");
67
48
 
68
49
  var _i18n = require("@wordpress/i18n");
69
50
 
70
- var _data = require("@wordpress/data");
71
-
72
51
  var _richText = require("@wordpress/rich-text");
73
52
 
74
53
  var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
75
54
 
76
- var _controls = require("../store/controls");
77
-
78
- var _constants = require("./constants");
79
-
80
55
  /**
81
56
  * External dependencies
82
57
  */
@@ -86,49 +61,53 @@ var _constants = require("./constants");
86
61
  */
87
62
 
88
63
  /**
89
- * Internal dependencies
90
- */
91
-
92
- /**
93
- * Generator which will yield a default block insert action if there
94
- * are no other blocks at the root of the editor. This generator should be used
64
+ * Action which will insert a default block insert action if there
65
+ * are no other blocks at the root of the editor. This action should be used
95
66
  * in actions which may result in no blocks remaining in the editor (removal,
96
67
  * replacement, etc).
97
68
  */
98
- function* ensureDefaultBlock() {
99
- const count = yield _data.controls.select(_constants.STORE_NAME, 'getBlockCount'); // To avoid a focus loss when removing the last block, assure there is
69
+ const ensureDefaultBlock = () => ({
70
+ select,
71
+ dispatch
72
+ }) => {
73
+ // To avoid a focus loss when removing the last block, assure there is
100
74
  // always a default block if the last of the blocks have been removed.
75
+ const count = select.getBlockCount();
101
76
 
102
- if (count === 0) {
103
- const {
104
- __unstableHasCustomAppender
105
- } = yield _data.controls.select(_constants.STORE_NAME, 'getSettings'); // If there's an custom appender, don't insert default block.
106
- // We have to remember to manually move the focus elsewhere to
107
- // prevent it from being lost though.
77
+ if (count > 0) {
78
+ return;
79
+ } // If there's an custom appender, don't insert default block.
80
+ // We have to remember to manually move the focus elsewhere to
81
+ // prevent it from being lost though.
108
82
 
109
- if (__unstableHasCustomAppender) {
110
- return;
111
- }
112
83
 
113
- return yield insertDefaultBlock();
84
+ const {
85
+ __unstableHasCustomAppender
86
+ } = select.getSettings();
87
+
88
+ if (__unstableHasCustomAppender) {
89
+ return;
114
90
  }
115
- }
91
+
92
+ dispatch.insertDefaultBlock();
93
+ };
116
94
  /**
117
- * Returns an action object used in signalling that blocks state should be
118
- * reset to the specified array of blocks, taking precedence over any other
119
- * content reflected as an edit in state.
95
+ * Action that resets blocks state to the specified array of blocks, taking precedence
96
+ * over any other content reflected as an edit in state.
120
97
  *
121
98
  * @param {Array} blocks Array of blocks.
122
99
  */
123
100
 
124
101
 
125
- function* resetBlocks(blocks) {
126
- yield {
102
+ const resetBlocks = blocks => ({
103
+ dispatch
104
+ }) => {
105
+ dispatch({
127
106
  type: 'RESET_BLOCKS',
128
107
  blocks
129
- };
130
- return yield* validateBlocksToTemplate(blocks);
131
- }
108
+ });
109
+ dispatch(validateBlocksToTemplate(blocks));
110
+ };
132
111
  /**
133
112
  * Block validity is a function of blocks state (at the point of a
134
113
  * reset) and the template setting. As a compromise to its placement
@@ -139,20 +118,25 @@ function* resetBlocks(blocks) {
139
118
  */
140
119
 
141
120
 
142
- function* validateBlocksToTemplate(blocks) {
143
- const template = yield _data.controls.select(_constants.STORE_NAME, 'getTemplate');
144
- const templateLock = yield _data.controls.select(_constants.STORE_NAME, 'getTemplateLock'); // Unlocked templates are considered always valid because they act
121
+ exports.resetBlocks = resetBlocks;
122
+
123
+ const validateBlocksToTemplate = blocks => ({
124
+ select,
125
+ dispatch
126
+ }) => {
127
+ const template = select.getTemplate();
128
+ const templateLock = select.getTemplateLock(); // Unlocked templates are considered always valid because they act
145
129
  // as default values only.
146
130
 
147
131
  const isBlocksValidToTemplate = !template || templateLock !== 'all' || (0, _blocks.doBlocksMatchTemplate)(blocks, template); // Update if validity has changed.
148
132
 
149
- const isValidTemplate = yield _data.controls.select(_constants.STORE_NAME, 'isValidTemplate');
133
+ const isValidTemplate = select.isValidTemplate();
150
134
 
151
135
  if (isBlocksValidToTemplate !== isValidTemplate) {
152
- yield setTemplateValidity(isBlocksValidToTemplate);
136
+ dispatch.setTemplateValidity(isBlocksValidToTemplate);
153
137
  return isBlocksValidToTemplate;
154
138
  }
155
- }
139
+ };
156
140
  /**
157
141
  * A block selection object.
158
142
  *
@@ -164,6 +148,8 @@ function* validateBlocksToTemplate(blocks) {
164
148
  * text value. See `wp.richText.create`.
165
149
  */
166
150
 
151
+ /* eslint-disable jsdoc/valid-types */
152
+
167
153
  /**
168
154
  * Returns an action object used in signalling that selection state should be
169
155
  * reset to the specified selection.
@@ -176,7 +162,10 @@ function* validateBlocksToTemplate(blocks) {
176
162
  */
177
163
 
178
164
 
165
+ exports.validateBlocksToTemplate = validateBlocksToTemplate;
166
+
179
167
  function resetSelection(selectionStart, selectionEnd, initialPosition) {
168
+ /* eslint-enable jsdoc/valid-types */
180
169
  return {
181
170
  type: 'RESET_SELECTION',
182
171
  selectionStart,
@@ -208,8 +197,7 @@ function receiveBlocks(blocks) {
208
197
  };
209
198
  }
210
199
  /**
211
- * Returns an action object used in signalling that the multiple blocks'
212
- * attributes with the specified client IDs have been updated.
200
+ * Action that updates attributes of multiple blocks with the specified client IDs.
213
201
  *
214
202
  * @param {string|string[]} clientIds Block client IDs.
215
203
  * @param {Object} attributes Block attributes to be merged. Should be keyed by clientIds if
@@ -228,8 +216,7 @@ function updateBlockAttributes(clientIds, attributes, uniqueByBlock = false) {
228
216
  };
229
217
  }
230
218
  /**
231
- * Returns an action object used in signalling that the block with the
232
- * specified client ID has been updated.
219
+ * Action that updates the block with the specified client ID.
233
220
  *
234
221
  * @param {string} clientId Block client ID.
235
222
  * @param {Object} updates Block attributes to be merged.
@@ -245,6 +232,8 @@ function updateBlock(clientId, updates) {
245
232
  updates
246
233
  };
247
234
  }
235
+ /* eslint-disable jsdoc/valid-types */
236
+
248
237
  /**
249
238
  * Returns an action object used in signalling that the block with the
250
239
  * specified client ID has been selected, optionally accepting a position
@@ -260,6 +249,7 @@ function updateBlock(clientId, updates) {
260
249
 
261
250
 
262
251
  function selectBlock(clientId, initialPosition = 0) {
252
+ /* eslint-enable jsdoc/valid-types */
263
253
  return {
264
254
  type: 'SELECT_BLOCK',
265
255
  initialPosition,
@@ -274,14 +264,16 @@ function selectBlock(clientId, initialPosition = 0) {
274
264
  */
275
265
 
276
266
 
277
- function* selectPreviousBlock(clientId) {
278
- const previousBlockClientId = yield _data.controls.select(_constants.STORE_NAME, 'getPreviousBlockClientId', clientId);
267
+ const selectPreviousBlock = clientId => ({
268
+ select,
269
+ dispatch
270
+ }) => {
271
+ const previousBlockClientId = select.getPreviousBlockClientId(clientId);
279
272
 
280
273
  if (previousBlockClientId) {
281
- yield selectBlock(previousBlockClientId, -1);
282
- return [previousBlockClientId];
274
+ dispatch.selectBlock(previousBlockClientId, -1);
283
275
  }
284
- }
276
+ };
285
277
  /**
286
278
  * Yields action objects used in signalling that the block following the given
287
279
  * clientId should be selected.
@@ -290,28 +282,34 @@ function* selectPreviousBlock(clientId) {
290
282
  */
291
283
 
292
284
 
293
- function* selectNextBlock(clientId) {
294
- const nextBlockClientId = yield _data.controls.select(_constants.STORE_NAME, 'getNextBlockClientId', clientId);
285
+ exports.selectPreviousBlock = selectPreviousBlock;
286
+
287
+ const selectNextBlock = clientId => ({
288
+ select,
289
+ dispatch
290
+ }) => {
291
+ const nextBlockClientId = select.getNextBlockClientId(clientId);
295
292
 
296
293
  if (nextBlockClientId) {
297
- yield selectBlock(nextBlockClientId);
298
- return [nextBlockClientId];
294
+ dispatch.selectBlock(nextBlockClientId);
299
295
  }
300
- }
296
+ };
301
297
  /**
302
- * Returns an action object used in signalling that a block multi-selection has started.
298
+ * Action that starts block multi-selection.
303
299
  *
304
300
  * @return {Object} Action object.
305
301
  */
306
302
 
307
303
 
304
+ exports.selectNextBlock = selectNextBlock;
305
+
308
306
  function startMultiSelect() {
309
307
  return {
310
308
  type: 'START_MULTI_SELECT'
311
309
  };
312
310
  }
313
311
  /**
314
- * Returns an action object used in signalling that block multi-selection stopped.
312
+ * Action that stops block multi-selection.
315
313
  *
316
314
  * @return {Object} Action object.
317
315
  */
@@ -323,45 +321,50 @@ function stopMultiSelect() {
323
321
  };
324
322
  }
325
323
  /**
326
- * Returns an action object used in signalling that block multi-selection changed.
324
+ * Action that changes block multi-selection.
327
325
  *
328
326
  * @param {string} start First block of the multi selection.
329
327
  * @param {string} end Last block of the multiselection.
330
328
  */
331
329
 
332
330
 
333
- function* multiSelect(start, end) {
334
- const startBlockRootClientId = yield _data.controls.select(_constants.STORE_NAME, 'getBlockRootClientId', start);
335
- const endBlockRootClientId = yield _data.controls.select(_constants.STORE_NAME, 'getBlockRootClientId', end); // Only allow block multi-selections at the same level.
331
+ const multiSelect = (start, end) => ({
332
+ select,
333
+ dispatch
334
+ }) => {
335
+ const startBlockRootClientId = select.getBlockRootClientId(start);
336
+ const endBlockRootClientId = select.getBlockRootClientId(end); // Only allow block multi-selections at the same level.
336
337
 
337
338
  if (startBlockRootClientId !== endBlockRootClientId) {
338
339
  return;
339
340
  }
340
341
 
341
- yield {
342
+ dispatch({
342
343
  type: 'MULTI_SELECT',
343
344
  start,
344
345
  end
345
- };
346
- const blockCount = yield _data.controls.select(_constants.STORE_NAME, 'getSelectedBlockCount');
346
+ });
347
+ const blockCount = select.getSelectedBlockCount();
347
348
  (0, _a11y.speak)((0, _i18n.sprintf)(
348
349
  /* translators: %s: number of selected blocks */
349
350
  (0, _i18n._n)('%s block selected.', '%s blocks selected.', blockCount), blockCount), 'assertive');
350
- }
351
+ };
351
352
  /**
352
- * Returns an action object used in signalling that the block selection is cleared.
353
+ * Action that clears the block selection.
353
354
  *
354
355
  * @return {Object} Action object.
355
356
  */
356
357
 
357
358
 
359
+ exports.multiSelect = multiSelect;
360
+
358
361
  function clearSelectedBlock() {
359
362
  return {
360
363
  type: 'CLEAR_SELECTED_BLOCK'
361
364
  };
362
365
  }
363
366
  /**
364
- * Returns an action object that enables or disables block selection.
367
+ * Action that enables or disables block selection.
365
368
  *
366
369
  * @param {boolean} [isSelectionEnabled=true] Whether block selection should
367
370
  * be enabled.
@@ -411,9 +414,10 @@ function getBlocksWithDefaultStylesApplied(blocks, blockEditorSettings) {
411
414
  };
412
415
  });
413
416
  }
417
+ /* eslint-disable jsdoc/valid-types */
418
+
414
419
  /**
415
- * Returns an action object signalling that a blocks should be replaced with
416
- * one or more replacement blocks.
420
+ * Action that replaces given blocks with one or more replacement blocks.
417
421
  *
418
422
  * @param {(string|string[])} clientIds Block client ID(s) to replace.
419
423
  * @param {(Object|Object[])} blocks Replacement block(s).
@@ -421,25 +425,29 @@ function getBlocksWithDefaultStylesApplied(blocks, blockEditorSettings) {
421
425
  * @param {0|-1|null} initialPosition Index of caret after in the selected block after the operation.
422
426
  * @param {?Object} meta Optional Meta values to be passed to the action object.
423
427
  *
424
- * @yield {Object} Action object.
428
+ * @return {Object} Action object.
425
429
  */
426
430
 
427
431
 
428
- function* replaceBlocks(clientIds, blocks, indexToSelect, initialPosition = 0, meta) {
432
+ const replaceBlocks = (clientIds, blocks, indexToSelect, initialPosition = 0, meta) => ({
433
+ select,
434
+ dispatch
435
+ }) => {
436
+ /* eslint-enable jsdoc/valid-types */
429
437
  clientIds = (0, _lodash.castArray)(clientIds);
430
- blocks = getBlocksWithDefaultStylesApplied((0, _lodash.castArray)(blocks), yield _data.controls.select(_constants.STORE_NAME, 'getSettings'));
431
- const rootClientId = yield _data.controls.select(_constants.STORE_NAME, 'getBlockRootClientId', (0, _lodash.first)(clientIds)); // Replace is valid if the new blocks can be inserted in the root block.
438
+ blocks = getBlocksWithDefaultStylesApplied((0, _lodash.castArray)(blocks), select.getSettings());
439
+ const rootClientId = select.getBlockRootClientId((0, _lodash.first)(clientIds)); // Replace is valid if the new blocks can be inserted in the root block.
432
440
 
433
441
  for (let index = 0; index < blocks.length; index++) {
434
442
  const block = blocks[index];
435
- const canInsertBlock = yield _data.controls.select(_constants.STORE_NAME, 'canInsertBlockType', block.name, rootClientId);
443
+ const canInsertBlock = select.canInsertBlockType(block.name, rootClientId);
436
444
 
437
445
  if (!canInsertBlock) {
438
446
  return;
439
447
  }
440
448
  }
441
449
 
442
- yield {
450
+ dispatch({
443
451
  type: 'REPLACE_BLOCKS',
444
452
  clientIds,
445
453
  blocks,
@@ -447,12 +455,11 @@ function* replaceBlocks(clientIds, blocks, indexToSelect, initialPosition = 0, m
447
455
  indexToSelect,
448
456
  initialPosition,
449
457
  meta
450
- };
451
- yield* ensureDefaultBlock();
452
- }
458
+ });
459
+ dispatch(ensureDefaultBlock());
460
+ };
453
461
  /**
454
- * Returns an action object signalling that a single block should be replaced
455
- * with one or more replacement blocks.
462
+ * Action that replaces a single block with one or more replacement blocks.
456
463
  *
457
464
  * @param {(string|string[])} clientId Block client ID to replace.
458
465
  * @param {(Object|Object[])} block Replacement block(s).
@@ -461,6 +468,8 @@ function* replaceBlocks(clientIds, blocks, indexToSelect, initialPosition = 0, m
461
468
  */
462
469
 
463
470
 
471
+ exports.replaceBlocks = replaceBlocks;
472
+
464
473
  function replaceBlock(clientId, block) {
465
474
  return replaceBlocks(clientId, block);
466
475
  }
@@ -474,86 +483,89 @@ function replaceBlock(clientId, block) {
474
483
  */
475
484
 
476
485
 
477
- function createOnMove(type) {
478
- return (clientIds, rootClientId) => {
479
- return {
480
- clientIds: (0, _lodash.castArray)(clientIds),
481
- type,
482
- rootClientId
483
- };
484
- };
485
- }
486
+ const createOnMove = type => (clientIds, rootClientId) => ({
487
+ select,
488
+ dispatch
489
+ }) => {
490
+ // If one of the blocks is locked or the parent is locked, we cannot move any block.
491
+ const canMoveBlocks = select.canMoveBlocks(clientIds, rootClientId);
492
+
493
+ if (!canMoveBlocks) {
494
+ return;
495
+ }
496
+
497
+ dispatch({
498
+ type,
499
+ clientIds: (0, _lodash.castArray)(clientIds),
500
+ rootClientId
501
+ });
502
+ };
486
503
 
487
504
  const moveBlocksDown = createOnMove('MOVE_BLOCKS_DOWN');
488
505
  exports.moveBlocksDown = moveBlocksDown;
489
506
  const moveBlocksUp = createOnMove('MOVE_BLOCKS_UP');
490
507
  /**
491
- * Returns an action object signalling that the given blocks should be moved to
492
- * a new position.
508
+ * Action that moves given blocks to a new position.
493
509
  *
494
510
  * @param {?string} clientIds The client IDs of the blocks.
495
511
  * @param {?string} fromRootClientId Root client ID source.
496
512
  * @param {?string} toRootClientId Root client ID destination.
497
513
  * @param {number} index The index to move the blocks to.
498
- *
499
- * @yield {Object} Action object.
500
514
  */
501
515
 
502
516
  exports.moveBlocksUp = moveBlocksUp;
503
517
 
504
- function* moveBlocksToPosition(clientIds, fromRootClientId = '', toRootClientId = '', index) {
505
- const templateLock = yield _data.controls.select(_constants.STORE_NAME, 'getTemplateLock', fromRootClientId); // If locking is equal to all on the original clientId (fromRootClientId),
506
- // it is not possible to move the block to any other position.
518
+ const moveBlocksToPosition = (clientIds, fromRootClientId = '', toRootClientId = '', index) => ({
519
+ select,
520
+ dispatch
521
+ }) => {
522
+ const canMoveBlocks = select.canMoveBlocks(clientIds, fromRootClientId); // If one of the blocks is locked or the parent is locked, we cannot move any block.
507
523
 
508
- if (templateLock === 'all') {
524
+ if (!canMoveBlocks) {
509
525
  return;
526
+ } // If moving inside the same root block the move is always possible.
527
+
528
+
529
+ if (fromRootClientId !== toRootClientId) {
530
+ const canRemoveBlocks = select.canRemoveBlocks(clientIds, fromRootClientId); // If we're moving to another block, it means we're deleting blocks from
531
+ // the original block, so we need to check if removing is possible.
532
+
533
+ if (!canRemoveBlocks) {
534
+ return;
535
+ }
536
+
537
+ const canInsertBlocks = select.canInsertBlocks(clientIds, toRootClientId); // 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
+
539
+ if (!canInsertBlocks) {
540
+ return;
541
+ }
510
542
  }
511
543
 
512
- const action = {
544
+ dispatch({
513
545
  type: 'MOVE_BLOCKS_TO_POSITION',
514
546
  fromRootClientId,
515
547
  toRootClientId,
516
548
  clientIds,
517
549
  index
518
- }; // If moving inside the same root block the move is always possible.
519
-
520
- if (fromRootClientId === toRootClientId) {
521
- yield action;
522
- return;
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
-
527
-
528
- if (templateLock === 'insert') {
529
- return;
530
- }
531
-
532
- const canInsertBlocks = yield _data.controls.select(_constants.STORE_NAME, 'canInsertBlocks', clientIds, toRootClientId); // 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.
533
-
534
- if (canInsertBlocks) {
535
- yield action;
536
- }
537
- }
550
+ });
551
+ };
538
552
  /**
539
- * Returns an action object signalling that the given block should be moved to a
540
- * new position.
553
+ * Action that moves given block to a new position.
541
554
  *
542
555
  * @param {?string} clientId The client ID of the block.
543
556
  * @param {?string} fromRootClientId Root client ID source.
544
557
  * @param {?string} toRootClientId Root client ID destination.
545
558
  * @param {number} index The index to move the block to.
546
- *
547
- * @yield {Object} Action object.
548
559
  */
549
560
 
550
561
 
551
- function* moveBlockToPosition(clientId, fromRootClientId = '', toRootClientId = '', index) {
552
- yield moveBlocksToPosition([clientId], fromRootClientId, toRootClientId, index);
562
+ exports.moveBlocksToPosition = moveBlocksToPosition;
563
+
564
+ function moveBlockToPosition(clientId, fromRootClientId = '', toRootClientId = '', index) {
565
+ return moveBlocksToPosition([clientId], fromRootClientId, toRootClientId, index);
553
566
  }
554
567
  /**
555
- * Returns an action object used in signalling that a single block should be
556
- * inserted, optionally at a specific index respective a root block list.
568
+ * Action that inserts a single block, optionally at a specific index respective a root block list.
557
569
  *
558
570
  * @param {Object} block Block object to insert.
559
571
  * @param {?number} index Index at which block should be inserted.
@@ -565,12 +577,13 @@ function* moveBlockToPosition(clientId, fromRootClientId = '', toRootClientId =
565
577
  */
566
578
 
567
579
 
568
- function insertBlock(block, index, rootClientId, updateSelection = true, meta) {
580
+ function insertBlock(block, index, rootClientId, updateSelection, meta) {
569
581
  return insertBlocks([block], index, rootClientId, updateSelection, 0, meta);
570
582
  }
583
+ /* eslint-disable jsdoc/valid-types */
584
+
571
585
  /**
572
- * Returns an action object used in signalling that an array of blocks should
573
- * be inserted, optionally at a specific index respective a root block list.
586
+ * Action that inserts an array of blocks, optionally at a specific index respective a root block list.
574
587
  *
575
588
  * @param {Object[]} blocks Block objects to insert.
576
589
  * @param {?number} index Index at which block should be inserted.
@@ -582,7 +595,11 @@ function insertBlock(block, index, rootClientId, updateSelection = true, meta) {
582
595
  */
583
596
 
584
597
 
585
- function* insertBlocks(blocks, index, rootClientId, updateSelection = true, initialPosition = 0, meta) {
598
+ const insertBlocks = (blocks, index, rootClientId, updateSelection = true, initialPosition = 0, meta) => ({
599
+ select,
600
+ dispatch
601
+ }) => {
602
+ /* eslint-enable jsdoc/valid-types */
586
603
  if ((0, _lodash.isObject)(initialPosition)) {
587
604
  meta = initialPosition;
588
605
  initialPosition = 0;
@@ -593,11 +610,11 @@ function* insertBlocks(blocks, index, rootClientId, updateSelection = true, init
593
610
  });
594
611
  }
595
612
 
596
- blocks = getBlocksWithDefaultStylesApplied((0, _lodash.castArray)(blocks), yield _data.controls.select(_constants.STORE_NAME, 'getSettings'));
613
+ blocks = getBlocksWithDefaultStylesApplied((0, _lodash.castArray)(blocks), select.getSettings());
597
614
  const allowedBlocks = [];
598
615
 
599
616
  for (const block of blocks) {
600
- const isValid = yield _data.controls.select(_constants.STORE_NAME, 'canInsertBlockType', block.name, rootClientId);
617
+ const isValid = select.canInsertBlockType(block.name, rootClientId);
601
618
 
602
619
  if (isValid) {
603
620
  allowedBlocks.push(block);
@@ -605,7 +622,7 @@ function* insertBlocks(blocks, index, rootClientId, updateSelection = true, init
605
622
  }
606
623
 
607
624
  if (allowedBlocks.length) {
608
- return {
625
+ dispatch({
609
626
  type: 'INSERT_BLOCKS',
610
627
  blocks: allowedBlocks,
611
628
  index,
@@ -614,12 +631,11 @@ function* insertBlocks(blocks, index, rootClientId, updateSelection = true, init
614
631
  updateSelection,
615
632
  initialPosition: updateSelection ? initialPosition : null,
616
633
  meta
617
- };
634
+ });
618
635
  }
619
- }
636
+ };
620
637
  /**
621
- * Returns an action object used in signalling that the insertion point should
622
- * be shown.
638
+ * Action that shows the insertion point.
623
639
  *
624
640
  * @param {?string} rootClientId Optional root client ID of block list on
625
641
  * which to insert.
@@ -630,6 +646,8 @@ function* insertBlocks(blocks, index, rootClientId, updateSelection = true, init
630
646
  */
631
647
 
632
648
 
649
+ exports.insertBlocks = insertBlocks;
650
+
633
651
  function showInsertionPoint(rootClientId, index, __unstableOptions = {}) {
634
652
  const {
635
653
  __unstableWithInserter
@@ -642,7 +660,7 @@ function showInsertionPoint(rootClientId, index, __unstableOptions = {}) {
642
660
  };
643
661
  }
644
662
  /**
645
- * Returns an action object hiding the insertion point.
663
+ * Action that hides the insertion point.
646
664
  *
647
665
  * @return {Object} Action object.
648
666
  */
@@ -654,7 +672,7 @@ function hideInsertionPoint() {
654
672
  };
655
673
  }
656
674
  /**
657
- * Returns an action object resetting the template validity.
675
+ * Action that resets the template validity.
658
676
  *
659
677
  * @param {boolean} isValid template validity flag.
660
678
  *
@@ -669,51 +687,59 @@ function setTemplateValidity(isValid) {
669
687
  };
670
688
  }
671
689
  /**
672
- * Returns an action object synchronize the template with the list of blocks
690
+ * Action that synchronizes the template with the list of blocks.
673
691
  *
674
692
  * @return {Object} Action object.
675
693
  */
676
694
 
677
695
 
678
- function* synchronizeTemplate() {
679
- yield {
696
+ const synchronizeTemplate = () => ({
697
+ select,
698
+ dispatch
699
+ }) => {
700
+ dispatch({
680
701
  type: 'SYNCHRONIZE_TEMPLATE'
681
- };
682
- const blocks = yield _data.controls.select(_constants.STORE_NAME, 'getBlocks');
683
- const template = yield _data.controls.select(_constants.STORE_NAME, 'getTemplate');
702
+ });
703
+ const blocks = select.getBlocks();
704
+ const template = select.getTemplate();
684
705
  const updatedBlockList = (0, _blocks.synchronizeBlocksWithTemplate)(blocks, template);
685
- return yield resetBlocks(updatedBlockList);
686
- }
706
+ dispatch.resetBlocks(updatedBlockList);
707
+ };
687
708
  /**
688
- * Returns an action object used in signalling that two blocks should be merged
709
+ * Action that merges two blocks.
689
710
  *
690
711
  * @param {string} firstBlockClientId Client ID of the first block to merge.
691
712
  * @param {string} secondBlockClientId Client ID of the second block to merge.
692
713
  */
693
714
 
694
715
 
695
- function* mergeBlocks(firstBlockClientId, secondBlockClientId) {
716
+ exports.synchronizeTemplate = synchronizeTemplate;
717
+
718
+ const mergeBlocks = (firstBlockClientId, secondBlockClientId) => ({
719
+ select,
720
+ dispatch
721
+ }) => {
696
722
  const blocks = [firstBlockClientId, secondBlockClientId];
697
- yield {
723
+ dispatch({
698
724
  type: 'MERGE_BLOCKS',
699
725
  blocks
700
- };
726
+ });
701
727
  const [clientIdA, clientIdB] = blocks;
702
- const blockA = yield _data.controls.select(_constants.STORE_NAME, 'getBlock', clientIdA);
728
+ const blockA = select.getBlock(clientIdA);
703
729
  const blockAType = (0, _blocks.getBlockType)(blockA.name); // Only focus the previous block if it's not mergeable
704
730
 
705
- if (!blockAType.merge) {
706
- yield selectBlock(blockA.clientId);
731
+ if (blockAType && !blockAType.merge) {
732
+ dispatch.selectBlock(blockA.clientId);
707
733
  return;
708
734
  }
709
735
 
710
- const blockB = yield _data.controls.select(_constants.STORE_NAME, 'getBlock', clientIdB);
736
+ const blockB = select.getBlock(clientIdB);
711
737
  const blockBType = (0, _blocks.getBlockType)(blockB.name);
712
738
  const {
713
739
  clientId,
714
740
  attributeKey,
715
741
  offset
716
- } = yield _data.controls.select(_constants.STORE_NAME, 'getSelectionStart');
742
+ } = select.getSelectionStart();
717
743
  const selectedBlockType = clientId === clientIdA ? blockAType : blockBType;
718
744
  const attributeDefinition = selectedBlockType.attributes[attributeKey];
719
745
  const canRestoreTextSelection = (clientId === clientIdA || clientId === clientIdB) && attributeKey !== undefined && offset !== undefined && // We cannot restore text selection if the RichText identifier
@@ -791,16 +817,16 @@ function* mergeBlocks(firstBlockClientId, secondBlockClientId) {
791
817
  preserveWhiteSpace
792
818
  });
793
819
  updatedAttributes[newAttributeKey] = newHtml;
794
- yield selectionChange(blockA.clientId, newAttributeKey, newOffset, newOffset);
820
+ dispatch.selectionChange(blockA.clientId, newAttributeKey, newOffset, newOffset);
795
821
  }
796
822
 
797
- yield* replaceBlocks([blockA.clientId, blockB.clientId], [{ ...blockA,
823
+ dispatch.replaceBlocks([blockA.clientId, blockB.clientId], [{ ...blockA,
798
824
  attributes: { ...blockA.attributes,
799
825
  ...updatedAttributes
800
826
  }
801
827
  }, ...blocksWithTheSameType.slice(1)], 0 // If we don't pass the `indexToSelect` it will default to the last block.
802
828
  );
803
- }
829
+ };
804
830
  /**
805
831
  * Yields action objects used in signalling that the blocks corresponding to
806
832
  * the set of specified client IDs are to be removed.
@@ -811,36 +837,36 @@ function* mergeBlocks(firstBlockClientId, secondBlockClientId) {
811
837
  */
812
838
 
813
839
 
814
- function* removeBlocks(clientIds, selectPrevious = true) {
840
+ exports.mergeBlocks = mergeBlocks;
841
+
842
+ const removeBlocks = (clientIds, selectPrevious = true) => ({
843
+ select,
844
+ dispatch
845
+ }) => {
815
846
  if (!clientIds || !clientIds.length) {
816
847
  return;
817
848
  }
818
849
 
819
850
  clientIds = (0, _lodash.castArray)(clientIds);
820
- const rootClientId = yield _data.controls.select(_constants.STORE_NAME, 'getBlockRootClientId', clientIds[0]);
821
- const isLocked = yield _data.controls.select(_constants.STORE_NAME, 'getTemplateLock', rootClientId);
851
+ const rootClientId = select.getBlockRootClientId(clientIds[0]);
852
+ const canRemoveBlocks = select.canRemoveBlocks(clientIds, rootClientId);
822
853
 
823
- if (isLocked) {
854
+ if (!canRemoveBlocks) {
824
855
  return;
825
856
  }
826
857
 
827
- let previousBlockId;
828
-
829
858
  if (selectPrevious) {
830
- previousBlockId = yield selectPreviousBlock(clientIds[0]);
831
- } else {
832
- previousBlockId = yield _data.controls.select(_constants.STORE_NAME, 'getPreviousBlockClientId', clientIds[0]);
859
+ dispatch.selectPreviousBlock(clientIds[0]);
833
860
  }
834
861
 
835
- yield {
862
+ dispatch({
836
863
  type: 'REMOVE_BLOCKS',
837
864
  clientIds
838
- }; // To avoid a focus loss when removing the last block, assure there is
865
+ }); // To avoid a focus loss when removing the last block, assure there is
839
866
  // always a default block if the last of the blocks have been removed.
840
867
 
841
- const defaultBlockId = yield* ensureDefaultBlock();
842
- return [previousBlockId || defaultBlockId];
843
- }
868
+ dispatch(ensureDefaultBlock());
869
+ };
844
870
  /**
845
871
  * Returns an action object used in signalling that the block with the
846
872
  * specified client ID is to be removed.
@@ -853,9 +879,13 @@ function* removeBlocks(clientIds, selectPrevious = true) {
853
879
  */
854
880
 
855
881
 
882
+ exports.removeBlocks = removeBlocks;
883
+
856
884
  function removeBlock(clientId, selectPrevious) {
857
885
  return removeBlocks([clientId], selectPrevious);
858
886
  }
887
+ /* eslint-disable jsdoc/valid-types */
888
+
859
889
  /**
860
890
  * Returns an action object used in signalling that the inner blocks with the
861
891
  * specified client ID should be replaced.
@@ -869,6 +899,7 @@ function removeBlock(clientId, selectPrevious) {
869
899
 
870
900
 
871
901
  function replaceInnerBlocks(rootClientId, blocks, updateSelection = false, initialPosition = 0) {
902
+ /* eslint-enable jsdoc/valid-types */
872
903
  return {
873
904
  type: 'REPLACE_INNER_BLOCKS',
874
905
  rootClientId,
@@ -970,8 +1001,7 @@ function exitFormattedText() {
970
1001
  };
971
1002
  }
972
1003
  /**
973
- * Returns an action object used in signalling that the user caret has changed
974
- * position.
1004
+ * Action that changes the position of the user caret.
975
1005
  *
976
1006
  * @param {string} clientId The selected block client ID.
977
1007
  * @param {string} attributeKey The selected block attribute key.
@@ -992,8 +1022,7 @@ function selectionChange(clientId, attributeKey, startOffset, endOffset) {
992
1022
  };
993
1023
  }
994
1024
  /**
995
- * Returns an action object used in signalling that a new block of the default
996
- * type should be added to the block list.
1025
+ * Action that adds a new block of the default type to the block list.
997
1026
  *
998
1027
  * @param {?Object} attributes Optional attributes of the block to assign.
999
1028
  * @param {?string} rootClientId Optional root client ID of block list on which
@@ -1016,7 +1045,7 @@ function insertDefaultBlock(attributes, rootClientId, index) {
1016
1045
  return insertBlock(block, index, rootClientId);
1017
1046
  }
1018
1047
  /**
1019
- * Returns an action object that changes the nested settings of a given block.
1048
+ * Action that changes the nested settings of a given block.
1020
1049
  *
1021
1050
  * @param {string} clientId Client ID of the block whose nested setting are
1022
1051
  * being received.
@@ -1034,7 +1063,7 @@ function updateBlockListSettings(clientId, settings) {
1034
1063
  };
1035
1064
  }
1036
1065
  /**
1037
- * Returns an action object used in signalling that the block editor settings have been updated.
1066
+ * Action that updates the block editor settings.
1038
1067
  *
1039
1068
  * @param {Object} settings Updated settings
1040
1069
  *
@@ -1049,7 +1078,7 @@ function updateSettings(settings) {
1049
1078
  };
1050
1079
  }
1051
1080
  /**
1052
- * Returns an action object used in signalling that a temporary reusable blocks have been saved
1081
+ * Action that signals that a temporary reusable block has been saved
1053
1082
  * in order to switch its temporary id with the real id.
1054
1083
  *
1055
1084
  * @param {string} id Reusable block's id.
@@ -1067,7 +1096,7 @@ function __unstableSaveReusableBlock(id, updatedId) {
1067
1096
  };
1068
1097
  }
1069
1098
  /**
1070
- * Returns an action object used in signalling that the last block change should be marked explicitly as persistent.
1099
+ * Action that marks the last block change explicitly as persistent.
1071
1100
  *
1072
1101
  * @return {Object} Action object.
1073
1102
  */
@@ -1079,7 +1108,7 @@ function __unstableMarkLastChangeAsPersistent() {
1079
1108
  };
1080
1109
  }
1081
1110
  /**
1082
- * Returns an action object used in signalling that the next block change should be marked explicitly as not persistent.
1111
+ * Action that signals that the next block change should be marked explicitly as not persistent.
1083
1112
  *
1084
1113
  * @return {Object} Action object.
1085
1114
  */
@@ -1091,151 +1120,180 @@ function __unstableMarkNextChangeAsNotPersistent() {
1091
1120
  };
1092
1121
  }
1093
1122
  /**
1094
- * Returns an action object used in signalling that the last block change is
1095
- * an automatic change, meaning it was not performed by the user, and can be
1096
- * undone using the `Escape` and `Backspace` keys. This action must be called
1097
- * after the change was made, and any actions that are a consequence of it, so
1098
- * it is recommended to be called at the next idle period to ensure all
1123
+ * Action that marks the last block change as an automatic change, meaning it was not
1124
+ * performed by the user, and can be undone using the `Escape` and `Backspace` keys.
1125
+ * This action must be called after the change was made, and any actions that are a
1126
+ * consequence of it, so it is recommended to be called at the next idle period to ensure all
1099
1127
  * selection changes have been recorded.
1100
1128
  */
1101
1129
 
1102
1130
 
1103
- function* __unstableMarkAutomaticChange() {
1104
- yield {
1131
+ const __unstableMarkAutomaticChange = () => ({
1132
+ dispatch
1133
+ }) => {
1134
+ dispatch({
1105
1135
  type: 'MARK_AUTOMATIC_CHANGE'
1106
- };
1107
- yield (0, _controls.__unstableMarkAutomaticChangeFinalControl)();
1108
- }
1109
-
1110
- function __unstableMarkAutomaticChangeFinal() {
1111
- return {
1112
- type: 'MARK_AUTOMATIC_CHANGE_FINAL'
1113
- };
1114
- }
1136
+ });
1137
+ const {
1138
+ requestIdleCallback = cb => setTimeout(cb, 100)
1139
+ } = window;
1140
+ requestIdleCallback(() => {
1141
+ dispatch({
1142
+ type: 'MARK_AUTOMATIC_CHANGE_FINAL'
1143
+ });
1144
+ });
1145
+ };
1115
1146
  /**
1116
- * Generators that triggers an action used to enable or disable the navigation mode.
1147
+ * Action that enables or disables the navigation mode.
1117
1148
  *
1118
1149
  * @param {string} isNavigationMode Enable/Disable navigation mode.
1119
1150
  */
1120
1151
 
1121
1152
 
1122
- function* setNavigationMode(isNavigationMode = true) {
1123
- yield {
1153
+ exports.__unstableMarkAutomaticChange = __unstableMarkAutomaticChange;
1154
+
1155
+ const setNavigationMode = (isNavigationMode = true) => ({
1156
+ dispatch
1157
+ }) => {
1158
+ dispatch({
1124
1159
  type: 'SET_NAVIGATION_MODE',
1125
1160
  isNavigationMode
1126
- };
1161
+ });
1127
1162
 
1128
1163
  if (isNavigationMode) {
1129
1164
  (0, _a11y.speak)((0, _i18n.__)('You are currently in navigation mode. Navigate blocks using the Tab key and Arrow keys. Use Left and Right Arrow keys to move between nesting levels. To exit navigation mode and edit the selected block, press Enter.'));
1130
1165
  } else {
1131
1166
  (0, _a11y.speak)((0, _i18n.__)('You are currently in edit mode. To return to the navigation mode, press Escape.'));
1132
1167
  }
1133
- }
1168
+ };
1134
1169
  /**
1135
- * Generator that triggers an action used to enable or disable the block moving mode.
1170
+ * Action that enables or disables the block moving mode.
1136
1171
  *
1137
1172
  * @param {string|null} hasBlockMovingClientId Enable/Disable block moving mode.
1138
1173
  */
1139
1174
 
1140
1175
 
1141
- function* setBlockMovingClientId(hasBlockMovingClientId = null) {
1142
- yield {
1176
+ exports.setNavigationMode = setNavigationMode;
1177
+
1178
+ const setBlockMovingClientId = (hasBlockMovingClientId = null) => ({
1179
+ dispatch
1180
+ }) => {
1181
+ dispatch({
1143
1182
  type: 'SET_BLOCK_MOVING_MODE',
1144
1183
  hasBlockMovingClientId
1145
- };
1184
+ });
1146
1185
 
1147
1186
  if (hasBlockMovingClientId) {
1148
1187
  (0, _a11y.speak)((0, _i18n.__)('Use the Tab key and Arrow keys to choose new block location. Use Left and Right Arrow keys to move between nesting levels. Once location is selected press Enter or Space to move the block.'));
1149
1188
  }
1150
- }
1189
+ };
1151
1190
  /**
1152
- * Generator that triggers an action used to duplicate a list of blocks.
1191
+ * Action that duplicates a list of blocks.
1153
1192
  *
1154
1193
  * @param {string[]} clientIds
1155
1194
  * @param {boolean} updateSelection
1156
1195
  */
1157
1196
 
1158
1197
 
1159
- function* duplicateBlocks(clientIds, updateSelection = true) {
1160
- if (!clientIds && !clientIds.length) {
1198
+ exports.setBlockMovingClientId = setBlockMovingClientId;
1199
+
1200
+ const duplicateBlocks = (clientIds, updateSelection = true) => ({
1201
+ select,
1202
+ dispatch
1203
+ }) => {
1204
+ if (!clientIds || !clientIds.length) {
1161
1205
  return;
1162
- }
1206
+ } // Return early if blocks don't exist.
1163
1207
 
1164
- const blocks = yield _data.controls.select(_constants.STORE_NAME, 'getBlocksByClientId', clientIds);
1165
- const rootClientId = yield _data.controls.select(_constants.STORE_NAME, 'getBlockRootClientId', clientIds[0]); // Return early if blocks don't exist.
1208
+
1209
+ const blocks = select.getBlocksByClientId(clientIds);
1166
1210
 
1167
1211
  if ((0, _lodash.some)(blocks, block => !block)) {
1168
1212
  return;
1169
- }
1213
+ } // Return early if blocks don't support multiple usage.
1170
1214
 
1171
- const blockNames = blocks.map(block => block.name); // Return early if blocks don't support multiple usage.
1172
1215
 
1173
- if ((0, _lodash.some)(blockNames, blockName => !(0, _blocks.hasBlockSupport)(blockName, 'multiple', true))) {
1216
+ const blockNames = blocks.map(block => block.name);
1217
+
1218
+ if (blockNames.some(blockName => !(0, _blocks.hasBlockSupport)(blockName, 'multiple', true))) {
1174
1219
  return;
1175
1220
  }
1176
1221
 
1177
- const lastSelectedIndex = yield _data.controls.select(_constants.STORE_NAME, 'getBlockIndex', (0, _lodash.last)((0, _lodash.castArray)(clientIds)), rootClientId);
1222
+ const rootClientId = select.getBlockRootClientId(clientIds[0]);
1223
+ const lastSelectedIndex = select.getBlockIndex((0, _lodash.last)((0, _lodash.castArray)(clientIds)), rootClientId);
1178
1224
  const clonedBlocks = blocks.map(block => (0, _blocks.__experimentalCloneSanitizedBlock)(block));
1179
- yield insertBlocks(clonedBlocks, lastSelectedIndex + 1, rootClientId, updateSelection);
1225
+ dispatch.insertBlocks(clonedBlocks, lastSelectedIndex + 1, rootClientId, updateSelection);
1180
1226
 
1181
1227
  if (clonedBlocks.length > 1 && updateSelection) {
1182
- yield multiSelect((0, _lodash.first)(clonedBlocks).clientId, (0, _lodash.last)(clonedBlocks).clientId);
1228
+ dispatch.multiSelect((0, _lodash.first)(clonedBlocks).clientId, (0, _lodash.last)(clonedBlocks).clientId);
1183
1229
  }
1184
1230
 
1185
1231
  return clonedBlocks.map(block => block.clientId);
1186
- }
1232
+ };
1187
1233
  /**
1188
- * Generator used to insert an empty block after a given block.
1234
+ * Action that inserts an empty block before a given block.
1189
1235
  *
1190
1236
  * @param {string} clientId
1191
1237
  */
1192
1238
 
1193
1239
 
1194
- function* insertBeforeBlock(clientId) {
1240
+ exports.duplicateBlocks = duplicateBlocks;
1241
+
1242
+ const insertBeforeBlock = clientId => ({
1243
+ select,
1244
+ dispatch
1245
+ }) => {
1195
1246
  if (!clientId) {
1196
1247
  return;
1197
1248
  }
1198
1249
 
1199
- const rootClientId = yield _data.controls.select(_constants.STORE_NAME, 'getBlockRootClientId', clientId);
1200
- const isLocked = yield _data.controls.select(_constants.STORE_NAME, 'getTemplateLock', rootClientId);
1250
+ const rootClientId = select.getBlockRootClientId(clientId);
1251
+ const isLocked = select.getTemplateLock(rootClientId);
1201
1252
 
1202
1253
  if (isLocked) {
1203
1254
  return;
1204
1255
  }
1205
1256
 
1206
- const firstSelectedIndex = yield _data.controls.select(_constants.STORE_NAME, 'getBlockIndex', clientId, rootClientId);
1207
- return yield insertDefaultBlock({}, rootClientId, firstSelectedIndex);
1208
- }
1257
+ const firstSelectedIndex = select.getBlockIndex(clientId, rootClientId);
1258
+ return dispatch.insertDefaultBlock({}, rootClientId, firstSelectedIndex);
1259
+ };
1209
1260
  /**
1210
- * Generator used to insert an empty block before a given block.
1261
+ * Action that inserts an empty block after a given block.
1211
1262
  *
1212
1263
  * @param {string} clientId
1213
1264
  */
1214
1265
 
1215
1266
 
1216
- function* insertAfterBlock(clientId) {
1267
+ exports.insertBeforeBlock = insertBeforeBlock;
1268
+
1269
+ const insertAfterBlock = clientId => ({
1270
+ select,
1271
+ dispatch
1272
+ }) => {
1217
1273
  if (!clientId) {
1218
1274
  return;
1219
1275
  }
1220
1276
 
1221
- const rootClientId = yield _data.controls.select(_constants.STORE_NAME, 'getBlockRootClientId', clientId);
1222
- const isLocked = yield _data.controls.select(_constants.STORE_NAME, 'getTemplateLock', rootClientId);
1277
+ const rootClientId = select.getBlockRootClientId(clientId);
1278
+ const isLocked = select.getTemplateLock(rootClientId);
1223
1279
 
1224
1280
  if (isLocked) {
1225
1281
  return;
1226
1282
  }
1227
1283
 
1228
- const firstSelectedIndex = yield _data.controls.select(_constants.STORE_NAME, 'getBlockIndex', clientId, rootClientId);
1229
- return yield insertDefaultBlock({}, rootClientId, firstSelectedIndex + 1);
1230
- }
1284
+ const firstSelectedIndex = select.getBlockIndex(clientId, rootClientId);
1285
+ return dispatch.insertDefaultBlock({}, rootClientId, firstSelectedIndex + 1);
1286
+ };
1231
1287
  /**
1232
- * Returns an action object that toggles the highlighted block state.
1288
+ * Action that toggles the highlighted block state.
1233
1289
  *
1234
1290
  * @param {string} clientId The block's clientId.
1235
1291
  * @param {boolean} isHighlighted The highlight state.
1236
1292
  */
1237
1293
 
1238
1294
 
1295
+ exports.insertAfterBlock = insertAfterBlock;
1296
+
1239
1297
  function toggleBlockHighlight(clientId, isHighlighted) {
1240
1298
  return {
1241
1299
  type: 'TOGGLE_BLOCK_HIGHLIGHT',
@@ -1244,29 +1302,29 @@ function toggleBlockHighlight(clientId, isHighlighted) {
1244
1302
  };
1245
1303
  }
1246
1304
  /**
1247
- * Yields action objects used in signalling that the block corresponding to the
1248
- * given clientId should appear to "flash" by rhythmically highlighting it.
1305
+ * Action that "flashes" the block with a given `clientId` by rhythmically highlighting it.
1249
1306
  *
1250
1307
  * @param {string} clientId Target block client ID.
1251
1308
  */
1252
1309
 
1253
1310
 
1254
- function* flashBlock(clientId) {
1255
- yield toggleBlockHighlight(clientId, true);
1256
- yield {
1257
- type: 'SLEEP',
1258
- duration: 150
1259
- };
1260
- yield toggleBlockHighlight(clientId, false);
1261
- }
1311
+ const flashBlock = clientId => async ({
1312
+ dispatch
1313
+ }) => {
1314
+ dispatch(toggleBlockHighlight(clientId, true));
1315
+ await new Promise(resolve => setTimeout(resolve, 150));
1316
+ dispatch(toggleBlockHighlight(clientId, false));
1317
+ };
1262
1318
  /**
1263
- * Returns an action object that sets whether the block has controlled innerblocks.
1319
+ * Action that sets whether a block has controlled inner blocks.
1264
1320
  *
1265
1321
  * @param {string} clientId The block's clientId.
1266
1322
  * @param {boolean} hasControlledInnerBlocks True if the block's inner blocks are controlled.
1267
1323
  */
1268
1324
 
1269
1325
 
1326
+ exports.flashBlock = flashBlock;
1327
+
1270
1328
  function setHasControlledInnerBlocks(clientId, hasControlledInnerBlocks) {
1271
1329
  return {
1272
1330
  type: 'SET_HAS_CONTROLLED_INNER_BLOCKS',