@wordpress/block-editor 12.16.1-next.79a6196f.0 → 12.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (376) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +32 -0
  3. package/build/components/block-draggable/index.js +11 -3
  4. package/build/components/block-draggable/index.js.map +1 -1
  5. package/build/components/block-edit/context.js +3 -1
  6. package/build/components/block-edit/context.js.map +1 -1
  7. package/build/components/block-edit/index.js +4 -2
  8. package/build/components/block-edit/index.js.map +1 -1
  9. package/build/components/block-editing-mode/index.js +6 -3
  10. package/build/components/block-editing-mode/index.js.map +1 -1
  11. package/build/components/block-inspector/index.js +5 -2
  12. package/build/components/block-inspector/index.js.map +1 -1
  13. package/build/components/block-list/block.js +4 -3
  14. package/build/components/block-list/block.js.map +1 -1
  15. package/build/components/block-list/block.native.js +9 -5
  16. package/build/components/block-list/block.native.js.map +1 -1
  17. package/build/components/block-list/index.js +30 -4
  18. package/build/components/block-list/index.js.map +1 -1
  19. package/build/components/block-list/private-block-context.js +1 -1
  20. package/build/components/block-list/private-block-context.js.map +1 -1
  21. package/build/components/block-list/use-in-between-inserter.js +1 -1
  22. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  23. package/build/components/block-popover/inbetween.js +15 -3
  24. package/build/components/block-popover/inbetween.js.map +1 -1
  25. package/build/components/block-preview/auto.js +1 -1
  26. package/build/components/block-preview/auto.js.map +1 -1
  27. package/build/components/block-removal-warning-modal/index.js +3 -2
  28. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  29. package/build/components/block-settings-menu/block-settings-dropdown.js +2 -4
  30. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  31. package/build/components/block-switcher/block-transformations-menu.js +12 -1
  32. package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
  33. package/build/components/block-switcher/index.js +119 -90
  34. package/build/components/block-switcher/index.js.map +1 -1
  35. package/build/components/block-tools/insertion-point.js +10 -3
  36. package/build/components/block-tools/insertion-point.js.map +1 -1
  37. package/build/components/font-sizes/fluid-utils.js +7 -1
  38. package/build/components/font-sizes/fluid-utils.js.map +1 -1
  39. package/build/components/global-styles/border-panel.js +5 -14
  40. package/build/components/global-styles/border-panel.js.map +1 -1
  41. package/build/components/global-styles/effects-panel.js +7 -1
  42. package/build/components/global-styles/effects-panel.js.map +1 -1
  43. package/build/components/iframe/get-compatibility-styles.js +99 -0
  44. package/build/components/iframe/get-compatibility-styles.js.map +1 -0
  45. package/build/components/iframe/index.js +2 -3
  46. package/build/components/iframe/index.js.map +1 -1
  47. package/build/components/index.js +16 -2
  48. package/build/components/index.js.map +1 -1
  49. package/build/components/index.native.js +16 -2
  50. package/build/components/index.native.js.map +1 -1
  51. package/build/components/inspector-controls/groups.js +2 -0
  52. package/build/components/inspector-controls/groups.js.map +1 -1
  53. package/build/components/inspector-controls-tabs/styles-tab.js +3 -0
  54. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  55. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +3 -2
  56. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  57. package/build/components/link-control/link-preview.js +30 -26
  58. package/build/components/link-control/link-preview.js.map +1 -1
  59. package/build/components/link-control/search-input.js +1 -9
  60. package/build/components/link-control/search-input.js.map +1 -1
  61. package/build/components/list-view/block-contents.js +3 -1
  62. package/build/components/list-view/block-contents.js.map +1 -1
  63. package/build/components/list-view/block.js +10 -1
  64. package/build/components/list-view/block.js.map +1 -1
  65. package/build/components/list-view/branch.js +29 -8
  66. package/build/components/list-view/branch.js.map +1 -1
  67. package/build/components/list-view/drop-indicator.js +100 -32
  68. package/build/components/list-view/drop-indicator.js.map +1 -1
  69. package/build/components/list-view/index.js +52 -4
  70. package/build/components/list-view/index.js.map +1 -1
  71. package/build/components/list-view/leaf.js +2 -2
  72. package/build/components/list-view/leaf.js.map +1 -1
  73. package/build/components/list-view/use-list-view-block-indexes.js +30 -0
  74. package/build/components/list-view/use-list-view-block-indexes.js.map +1 -0
  75. package/build/components/list-view/use-list-view-drop-zone.js +56 -5
  76. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  77. package/build/components/list-view/utils.js +92 -0
  78. package/build/components/list-view/utils.js.map +1 -1
  79. package/build/components/provider/index.js +1 -1
  80. package/build/components/provider/index.js.map +1 -1
  81. package/build/components/recursion-provider/index.js +21 -0
  82. package/build/components/recursion-provider/index.js.map +1 -1
  83. package/build/components/rich-text/index.js +30 -6
  84. package/build/components/rich-text/index.js.map +1 -1
  85. package/build/components/rich-text/native/index.native.js +9 -9
  86. package/build/components/rich-text/native/index.native.js.map +1 -1
  87. package/build/components/use-block-drop-zone/index.js +30 -7
  88. package/build/components/use-block-drop-zone/index.js.map +1 -1
  89. package/build/components/use-on-block-drop/index.js +50 -8
  90. package/build/components/use-on-block-drop/index.js.map +1 -1
  91. package/build/hooks/block-hooks.js +5 -14
  92. package/build/hooks/block-hooks.js.map +1 -1
  93. package/build/hooks/content-lock-ui.js +17 -42
  94. package/build/hooks/content-lock-ui.js.map +1 -1
  95. package/build/hooks/effects.js +66 -0
  96. package/build/hooks/effects.js.map +1 -0
  97. package/build/hooks/index.js +14 -0
  98. package/build/hooks/index.js.map +1 -1
  99. package/build/hooks/index.native.js +13 -0
  100. package/build/hooks/index.native.js.map +1 -1
  101. package/build/hooks/style.js +6 -2
  102. package/build/hooks/style.js.map +1 -1
  103. package/build/hooks/supports.js +2 -1
  104. package/build/hooks/supports.js.map +1 -1
  105. package/build/hooks/typography.native.js +2 -2
  106. package/build/hooks/typography.native.js.map +1 -1
  107. package/build/hooks/use-bindings-attributes.js +115 -0
  108. package/build/hooks/use-bindings-attributes.js.map +1 -0
  109. package/build/hooks/use-shadow-props.js +46 -0
  110. package/build/hooks/use-shadow-props.js.map +1 -0
  111. package/build/hooks/utils.js +7 -6
  112. package/build/hooks/utils.js.map +1 -1
  113. package/build/index.js +14 -0
  114. package/build/index.js.map +1 -1
  115. package/build/store/actions.js +10 -6
  116. package/build/store/actions.js.map +1 -1
  117. package/build/store/index.js +2 -0
  118. package/build/store/index.js.map +1 -1
  119. package/build/store/private-actions.js +37 -0
  120. package/build/store/private-actions.js.map +1 -1
  121. package/build/store/private-selectors.js +60 -9
  122. package/build/store/private-selectors.js.map +1 -1
  123. package/build/store/reducer.js +44 -3
  124. package/build/store/reducer.js.map +1 -1
  125. package/build/store/resolvers.js +27 -0
  126. package/build/store/resolvers.js.map +1 -0
  127. package/build/store/selectors.js +94 -56
  128. package/build/store/selectors.js.map +1 -1
  129. package/build/store/utils.js +5 -26
  130. package/build/store/utils.js.map +1 -1
  131. package/build/utils/index.js +0 -16
  132. package/build/utils/index.js.map +1 -1
  133. package/build/utils/math.js +13 -0
  134. package/build/utils/math.js.map +1 -1
  135. package/build/utils/transform-styles/index.js +37 -27
  136. package/build/utils/transform-styles/index.js.map +1 -1
  137. package/build-module/components/block-draggable/index.js +11 -3
  138. package/build-module/components/block-draggable/index.js.map +1 -1
  139. package/build-module/components/block-edit/context.js +1 -0
  140. package/build-module/components/block-edit/context.js.map +1 -1
  141. package/build-module/components/block-edit/index.js +5 -3
  142. package/build-module/components/block-edit/index.js.map +1 -1
  143. package/build-module/components/block-editing-mode/index.js +7 -4
  144. package/build-module/components/block-editing-mode/index.js.map +1 -1
  145. package/build-module/components/block-inspector/index.js +5 -2
  146. package/build-module/components/block-inspector/index.js.map +1 -1
  147. package/build-module/components/block-list/block.js +6 -5
  148. package/build-module/components/block-list/block.js.map +1 -1
  149. package/build-module/components/block-list/block.native.js +11 -7
  150. package/build-module/components/block-list/block.native.js.map +1 -1
  151. package/build-module/components/block-list/index.js +31 -5
  152. package/build-module/components/block-list/index.js.map +1 -1
  153. package/build-module/components/block-list/private-block-context.js +1 -1
  154. package/build-module/components/block-list/private-block-context.js.map +1 -1
  155. package/build-module/components/block-list/use-in-between-inserter.js +1 -1
  156. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  157. package/build-module/components/block-popover/inbetween.js +15 -3
  158. package/build-module/components/block-popover/inbetween.js.map +1 -1
  159. package/build-module/components/block-preview/auto.js +3 -3
  160. package/build-module/components/block-preview/auto.js.map +1 -1
  161. package/build-module/components/block-removal-warning-modal/index.js +3 -2
  162. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  163. package/build-module/components/block-settings-menu/block-settings-dropdown.js +2 -4
  164. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  165. package/build-module/components/block-switcher/block-transformations-menu.js +12 -1
  166. package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
  167. package/build-module/components/block-switcher/index.js +116 -86
  168. package/build-module/components/block-switcher/index.js.map +1 -1
  169. package/build-module/components/block-tools/insertion-point.js +10 -3
  170. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  171. package/build-module/components/font-sizes/fluid-utils.js +7 -1
  172. package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
  173. package/build-module/components/global-styles/border-panel.js +5 -14
  174. package/build-module/components/global-styles/border-panel.js.map +1 -1
  175. package/build-module/components/global-styles/effects-panel.js +7 -1
  176. package/build-module/components/global-styles/effects-panel.js.map +1 -1
  177. package/build-module/components/iframe/get-compatibility-styles.js +93 -0
  178. package/build-module/components/iframe/get-compatibility-styles.js.map +1 -0
  179. package/build-module/components/iframe/index.js +2 -3
  180. package/build-module/components/iframe/index.js.map +1 -1
  181. package/build-module/components/index.js +1 -1
  182. package/build-module/components/index.js.map +1 -1
  183. package/build-module/components/index.native.js +1 -1
  184. package/build-module/components/index.native.js.map +1 -1
  185. package/build-module/components/inspector-controls/groups.js +2 -0
  186. package/build-module/components/inspector-controls/groups.js.map +1 -1
  187. package/build-module/components/inspector-controls-tabs/styles-tab.js +3 -0
  188. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  189. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +3 -2
  190. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  191. package/build-module/components/link-control/link-preview.js +32 -28
  192. package/build-module/components/link-control/link-preview.js.map +1 -1
  193. package/build-module/components/link-control/search-input.js +1 -8
  194. package/build-module/components/link-control/search-input.js.map +1 -1
  195. package/build-module/components/list-view/block-contents.js +3 -1
  196. package/build-module/components/list-view/block-contents.js.map +1 -1
  197. package/build-module/components/list-view/block.js +10 -1
  198. package/build-module/components/list-view/block.js.map +1 -1
  199. package/build-module/components/list-view/branch.js +30 -9
  200. package/build-module/components/list-view/branch.js.map +1 -1
  201. package/build-module/components/list-view/drop-indicator.js +99 -32
  202. package/build-module/components/list-view/drop-indicator.js.map +1 -1
  203. package/build-module/components/list-view/index.js +54 -6
  204. package/build-module/components/list-view/index.js.map +1 -1
  205. package/build-module/components/list-view/leaf.js +2 -2
  206. package/build-module/components/list-view/leaf.js.map +1 -1
  207. package/build-module/components/list-view/use-list-view-block-indexes.js +23 -0
  208. package/build-module/components/list-view/use-list-view-block-indexes.js.map +1 -0
  209. package/build-module/components/list-view/use-list-view-drop-zone.js +58 -7
  210. package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
  211. package/build-module/components/list-view/utils.js +91 -0
  212. package/build-module/components/list-view/utils.js.map +1 -1
  213. package/build-module/components/provider/index.js +1 -1
  214. package/build-module/components/provider/index.js.map +1 -1
  215. package/build-module/components/recursion-provider/index.js +17 -0
  216. package/build-module/components/recursion-provider/index.js.map +1 -1
  217. package/build-module/components/rich-text/index.js +30 -6
  218. package/build-module/components/rich-text/index.js.map +1 -1
  219. package/build-module/components/rich-text/native/index.native.js +9 -9
  220. package/build-module/components/rich-text/native/index.native.js.map +1 -1
  221. package/build-module/components/use-block-drop-zone/index.js +31 -8
  222. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  223. package/build-module/components/use-on-block-drop/index.js +51 -9
  224. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  225. package/build-module/hooks/block-hooks.js +5 -14
  226. package/build-module/hooks/block-hooks.js.map +1 -1
  227. package/build-module/hooks/content-lock-ui.js +19 -43
  228. package/build-module/hooks/content-lock-ui.js.map +1 -1
  229. package/build-module/hooks/effects.js +51 -0
  230. package/build-module/hooks/effects.js.map +1 -0
  231. package/build-module/hooks/index.js +2 -0
  232. package/build-module/hooks/index.js.map +1 -1
  233. package/build-module/hooks/index.native.js +1 -0
  234. package/build-module/hooks/index.native.js.map +1 -1
  235. package/build-module/hooks/style.js +6 -2
  236. package/build-module/hooks/style.js.map +1 -1
  237. package/build-module/hooks/supports.js +2 -1
  238. package/build-module/hooks/supports.js.map +1 -1
  239. package/build-module/hooks/typography.native.js +2 -2
  240. package/build-module/hooks/typography.native.js.map +1 -1
  241. package/build-module/hooks/use-bindings-attributes.js +112 -0
  242. package/build-module/hooks/use-bindings-attributes.js.map +1 -0
  243. package/build-module/hooks/use-shadow-props.js +39 -0
  244. package/build-module/hooks/use-shadow-props.js.map +1 -0
  245. package/build-module/hooks/utils.js +9 -8
  246. package/build-module/hooks/utils.js.map +1 -1
  247. package/build-module/index.js +1 -1
  248. package/build-module/index.js.map +1 -1
  249. package/build-module/store/actions.js +10 -6
  250. package/build-module/store/actions.js.map +1 -1
  251. package/build-module/store/index.js +2 -0
  252. package/build-module/store/index.js.map +1 -1
  253. package/build-module/store/private-actions.js +35 -0
  254. package/build-module/store/private-actions.js.map +1 -1
  255. package/build-module/store/private-selectors.js +53 -8
  256. package/build-module/store/private-selectors.js.map +1 -1
  257. package/build-module/store/reducer.js +43 -3
  258. package/build-module/store/reducer.js.map +1 -1
  259. package/build-module/store/resolvers.js +20 -0
  260. package/build-module/store/resolvers.js.map +1 -0
  261. package/build-module/store/selectors.js +89 -52
  262. package/build-module/store/selectors.js.map +1 -1
  263. package/build-module/store/utils.js +3 -23
  264. package/build-module/store/utils.js.map +1 -1
  265. package/build-module/utils/index.js +0 -1
  266. package/build-module/utils/index.js.map +1 -1
  267. package/build-module/utils/math.js +12 -0
  268. package/build-module/utils/math.js.map +1 -1
  269. package/build-module/utils/transform-styles/index.js +36 -27
  270. package/build-module/utils/transform-styles/index.js.map +1 -1
  271. package/build-style/content-rtl.css +33 -16
  272. package/build-style/content.css +33 -16
  273. package/build-style/default-editor-styles-rtl.css +1 -1
  274. package/build-style/default-editor-styles.css +1 -1
  275. package/build-style/style-rtl.css +169 -114
  276. package/build-style/style.css +169 -114
  277. package/package.json +31 -31
  278. package/src/components/block-canvas/style.scss +8 -1
  279. package/src/components/block-draggable/index.js +16 -5
  280. package/src/components/block-edit/context.js +1 -0
  281. package/src/components/block-edit/index.js +4 -0
  282. package/src/components/block-editing-mode/index.js +12 -7
  283. package/src/components/block-inspector/index.js +5 -2
  284. package/src/components/block-list/block.js +5 -4
  285. package/src/components/block-list/block.native.js +13 -3
  286. package/src/components/block-list/content.scss +34 -5
  287. package/src/components/block-list/index.js +52 -16
  288. package/src/components/block-list/private-block-context.js +1 -1
  289. package/src/components/block-list/use-in-between-inserter.js +1 -2
  290. package/src/components/block-popover/inbetween.js +22 -2
  291. package/src/components/block-preview/auto.js +3 -3
  292. package/src/components/block-removal-warning-modal/index.js +3 -2
  293. package/src/components/block-settings-menu/block-settings-dropdown.js +2 -7
  294. package/src/components/block-switcher/block-transformations-menu.js +18 -1
  295. package/src/components/block-switcher/index.js +133 -111
  296. package/src/components/block-switcher/style.scss +6 -4
  297. package/src/components/block-switcher/test/index.js +113 -230
  298. package/src/components/block-toolbar/style.scss +22 -18
  299. package/src/components/block-tools/insertion-point.js +15 -2
  300. package/src/components/block-tools/style.scss +8 -7
  301. package/src/components/font-sizes/fluid-utils.js +8 -2
  302. package/src/components/font-sizes/test/fluid-utils.js +9 -0
  303. package/src/components/global-styles/border-panel.js +7 -17
  304. package/src/components/global-styles/effects-panel.js +16 -1
  305. package/src/components/iframe/get-compatibility-styles.js +120 -0
  306. package/src/components/iframe/index.js +2 -3
  307. package/src/components/index.js +4 -2
  308. package/src/components/index.native.js +4 -2
  309. package/src/components/inspector-controls/groups.js +2 -0
  310. package/src/components/inspector-controls-tabs/styles-tab.js +1 -0
  311. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +2 -0
  312. package/src/components/link-control/link-preview.js +31 -55
  313. package/src/components/link-control/search-input.js +1 -9
  314. package/src/components/link-control/style.scss +31 -85
  315. package/src/components/link-control/test/index.js +2 -1
  316. package/src/components/list-view/block-contents.js +5 -1
  317. package/src/components/list-view/block.js +9 -0
  318. package/src/components/list-view/branch.js +30 -10
  319. package/src/components/list-view/drop-indicator.js +139 -46
  320. package/src/components/list-view/index.js +74 -3
  321. package/src/components/list-view/leaf.js +2 -2
  322. package/src/components/list-view/style.scss +102 -13
  323. package/src/components/list-view/test/use-list-view-drop-zone.js +4 -0
  324. package/src/components/list-view/test/utils.js +218 -1
  325. package/src/components/list-view/use-list-view-block-indexes.js +29 -0
  326. package/src/components/list-view/use-list-view-drop-zone.js +78 -6
  327. package/src/components/list-view/utils.js +116 -0
  328. package/src/components/provider/index.js +3 -1
  329. package/src/components/recursion-provider/README.md +2 -2
  330. package/src/components/recursion-provider/index.js +17 -0
  331. package/src/components/rich-text/index.js +48 -10
  332. package/src/components/rich-text/native/index.native.js +10 -10
  333. package/src/components/use-block-drop-zone/index.js +60 -19
  334. package/src/components/use-block-drop-zone/test/index.js +32 -61
  335. package/src/components/use-on-block-drop/index.js +92 -11
  336. package/src/hooks/block-hooks.js +5 -17
  337. package/src/hooks/content-lock-ui.js +15 -55
  338. package/src/hooks/effects.js +57 -0
  339. package/src/hooks/index.js +2 -0
  340. package/src/hooks/index.native.js +1 -0
  341. package/src/hooks/style.js +8 -0
  342. package/src/hooks/supports.js +2 -0
  343. package/src/hooks/test/effects.js +39 -0
  344. package/src/hooks/typography.native.js +2 -2
  345. package/src/hooks/use-bindings-attributes.js +148 -0
  346. package/src/hooks/use-shadow-props.js +37 -0
  347. package/src/hooks/utils.js +10 -6
  348. package/src/index.js +2 -0
  349. package/src/store/actions.js +9 -4
  350. package/src/store/index.js +2 -0
  351. package/src/store/private-actions.js +32 -0
  352. package/src/store/private-selectors.js +78 -21
  353. package/src/store/reducer.js +49 -2
  354. package/src/store/resolvers.js +17 -0
  355. package/src/store/selectors.js +169 -161
  356. package/src/store/test/registry-selectors.js +431 -0
  357. package/src/store/test/selectors.js +14 -400
  358. package/src/store/utils.js +10 -33
  359. package/src/style.scss +0 -1
  360. package/src/utils/index.js +0 -1
  361. package/src/utils/math.js +12 -0
  362. package/src/utils/transform-styles/index.js +52 -37
  363. package/tsconfig.tsbuildinfo +1 -1
  364. package/build/components/iframe/use-compatibility-styles.js +0 -100
  365. package/build/components/iframe/use-compatibility-styles.js.map +0 -1
  366. package/build/utils/block-variation-transforms.js +0 -42
  367. package/build/utils/block-variation-transforms.js.map +0 -1
  368. package/build-module/components/iframe/use-compatibility-styles.js +0 -94
  369. package/build-module/components/iframe/use-compatibility-styles.js.map +0 -1
  370. package/build-module/utils/block-variation-transforms.js +0 -35
  371. package/build-module/utils/block-variation-transforms.js.map +0 -1
  372. package/src/components/block-switcher/test/__snapshots__/index.js.snap +0 -116
  373. package/src/components/contrast-checker/style.scss +0 -3
  374. package/src/components/iframe/use-compatibility-styles.js +0 -122
  375. package/src/utils/block-variation-transforms.js +0 -38
  376. package/src/utils/test/block-variation-transforms.js +0 -94
@@ -127,6 +127,7 @@ describe( 'getListViewDropTarget', () => {
127
127
 
128
128
  expect( target ).toEqual( {
129
129
  blockIndex: 0,
130
+ clientId: 'block-1',
130
131
  dropPosition: 'inside',
131
132
  rootClientId: 'block-1',
132
133
  } );
@@ -142,6 +143,7 @@ describe( 'getListViewDropTarget', () => {
142
143
 
143
144
  expect( target ).toEqual( {
144
145
  blockIndex: 0,
146
+ clientId: 'block-3',
145
147
  dropPosition: 'inside',
146
148
  rootClientId: 'block-3',
147
149
  } );
@@ -244,6 +246,7 @@ describe( 'getListViewDropTarget', () => {
244
246
 
245
247
  expect( target ).toEqual( {
246
248
  blockIndex: 1,
249
+ clientId: 'block-1',
247
250
  dropPosition: 'inside',
248
251
  rootClientId: 'block-1',
249
252
  } );
@@ -277,6 +280,7 @@ describe( 'getListViewDropTarget', () => {
277
280
 
278
281
  expect( target ).toEqual( {
279
282
  blockIndex: 0,
283
+ clientId: 'block-1',
280
284
  dropPosition: 'inside',
281
285
  rootClientId: 'block-1',
282
286
  } );
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import { getCommonDepthClientIds } from '../utils';
4
+ import { getCommonDepthClientIds, getDragDisplacementValues } from '../utils';
5
5
 
6
6
  describe( 'getCommonDepthClientIds', () => {
7
7
  it( 'should return start and end when no depth is provided', () => {
@@ -48,3 +48,220 @@ describe( 'getCommonDepthClientIds', () => {
48
48
  expect( result ).toEqual( { start: 'start-3', end: 'clicked-id' } );
49
49
  } );
50
50
  } );
51
+
52
+ describe( 'getDragDisplacementValues', () => {
53
+ const blockIndexes = {
54
+ 'block-a': 0,
55
+ 'block-b': 1,
56
+ 'block-c': 2,
57
+ 'block-d': 3,
58
+ 'block-e': 4,
59
+ 'block-f': 5,
60
+ 'block-g': 6,
61
+ 'block-h': 7,
62
+ };
63
+
64
+ it( 'should return displacement of normal when block is after dragged block and drop target', () => {
65
+ const result = getDragDisplacementValues( {
66
+ blockIndexes,
67
+ blockDropTargetIndex: 3,
68
+ blockDropPosition: 'bottom',
69
+ clientId: 'block-h',
70
+ firstDraggedBlockIndex: 5,
71
+ isDragged: false,
72
+ } );
73
+
74
+ expect( result ).toEqual( {
75
+ displacement: 'normal',
76
+ isAfterDraggedBlocks: true,
77
+ isNesting: false,
78
+ } );
79
+ } );
80
+
81
+ it( 'should return displacement of up when block is after dragged block and before the drop target', () => {
82
+ const result = getDragDisplacementValues( {
83
+ blockIndexes,
84
+ blockDropTargetIndex: 7,
85
+ blockDropPosition: 'bottom',
86
+ clientId: 'block-d',
87
+ firstDraggedBlockIndex: 2,
88
+ isDragged: false,
89
+ } );
90
+
91
+ expect( result ).toEqual( {
92
+ displacement: 'up',
93
+ isAfterDraggedBlocks: true,
94
+ isNesting: false,
95
+ } );
96
+ } );
97
+
98
+ it( 'should return displacement of down when block is before dragged block and after the drop target', () => {
99
+ const result = getDragDisplacementValues( {
100
+ blockIndexes,
101
+ blockDropTargetIndex: 1,
102
+ blockDropPosition: 'bottom',
103
+ clientId: 'block-d',
104
+ firstDraggedBlockIndex: 6,
105
+ isDragged: false,
106
+ } );
107
+
108
+ expect( result ).toEqual( {
109
+ displacement: 'down',
110
+ isAfterDraggedBlocks: false,
111
+ isNesting: false,
112
+ } );
113
+ } );
114
+
115
+ it( 'should return isNesting of true when block is just before the drop target and drop position is inside', () => {
116
+ const result = getDragDisplacementValues( {
117
+ blockIndexes,
118
+ blockDropTargetIndex: 1,
119
+ blockDropPosition: 'inside',
120
+ clientId: 'block-a',
121
+ firstDraggedBlockIndex: 6,
122
+ isDragged: false,
123
+ } );
124
+
125
+ expect( result ).toEqual( {
126
+ displacement: 'normal',
127
+ isAfterDraggedBlocks: false,
128
+ isNesting: true,
129
+ } );
130
+ } );
131
+
132
+ it( 'should return isNesting of false when block is not just before the drop target and drop position is inside', () => {
133
+ const result = getDragDisplacementValues( {
134
+ blockIndexes,
135
+ blockDropTargetIndex: 1,
136
+ blockDropPosition: 'inside',
137
+ clientId: 'block-b',
138
+ firstDraggedBlockIndex: 6,
139
+ isDragged: false,
140
+ } );
141
+
142
+ expect( result ).toEqual( {
143
+ displacement: 'down',
144
+ isAfterDraggedBlocks: false,
145
+ isNesting: false,
146
+ } );
147
+ } );
148
+
149
+ it( 'should return displacement of up when drop target index is null and block is after dragged block', () => {
150
+ const result = getDragDisplacementValues( {
151
+ blockIndexes,
152
+ blockDropTargetIndex: null,
153
+ blockDropPosition: 'bottom',
154
+ clientId: 'block-h',
155
+ firstDraggedBlockIndex: 5,
156
+ isDragged: false,
157
+ } );
158
+
159
+ expect( result ).toEqual( {
160
+ displacement: 'up',
161
+ isAfterDraggedBlocks: true,
162
+ isNesting: false,
163
+ } );
164
+ } );
165
+
166
+ it( 'should return displacement of normal when drop target index is null and block is before dragged block', () => {
167
+ const result = getDragDisplacementValues( {
168
+ blockIndexes,
169
+ blockDropTargetIndex: null,
170
+ blockDropPosition: 'bottom',
171
+ clientId: 'block-c',
172
+ firstDraggedBlockIndex: 5,
173
+ isDragged: false,
174
+ } );
175
+
176
+ expect( result ).toEqual( {
177
+ displacement: 'normal',
178
+ isAfterDraggedBlocks: false,
179
+ isNesting: false,
180
+ } );
181
+ } );
182
+
183
+ it( 'should return displacement of normal when dragging a file (no dragged block) and the block is before the target index', () => {
184
+ const result = getDragDisplacementValues( {
185
+ blockIndexes,
186
+ blockDropTargetIndex: 3,
187
+ blockDropPosition: 'bottom',
188
+ clientId: 'block-b',
189
+ firstDraggedBlockIndex: undefined,
190
+ isDragged: false,
191
+ } );
192
+
193
+ expect( result ).toEqual( {
194
+ displacement: 'normal',
195
+ isAfterDraggedBlocks: false,
196
+ isNesting: false,
197
+ } );
198
+ } );
199
+
200
+ it( 'should return displacement of down when dragging a file (no dragged block) and the block is after the target index', () => {
201
+ const result = getDragDisplacementValues( {
202
+ blockIndexes,
203
+ blockDropTargetIndex: 3,
204
+ blockDropPosition: 'bottom',
205
+ clientId: 'block-h',
206
+ firstDraggedBlockIndex: undefined,
207
+ isDragged: false,
208
+ } );
209
+
210
+ expect( result ).toEqual( {
211
+ displacement: 'down',
212
+ isAfterDraggedBlocks: false,
213
+ isNesting: false,
214
+ } );
215
+ } );
216
+
217
+ it( 'should return displacement of normal when dragging a file (no dragged block) and dragging outside the list view (drop target of null)', () => {
218
+ const result = getDragDisplacementValues( {
219
+ blockIndexes,
220
+ blockDropTargetIndex: null,
221
+ blockDropPosition: 'bottom',
222
+ clientId: 'block-h',
223
+ firstDraggedBlockIndex: undefined,
224
+ isDragged: false,
225
+ } );
226
+
227
+ expect( result ).toEqual( {
228
+ displacement: 'normal',
229
+ isAfterDraggedBlocks: false,
230
+ isNesting: false,
231
+ } );
232
+ } );
233
+
234
+ it( 'should return undefined displacement if the target index is undefined', () => {
235
+ const result = getDragDisplacementValues( {
236
+ blockIndexes,
237
+ blockDropTargetIndex: undefined,
238
+ blockDropPosition: 'bottom',
239
+ clientId: 'block-h',
240
+ firstDraggedBlockIndex: undefined,
241
+ isDragged: false,
242
+ } );
243
+
244
+ expect( result ).toEqual( {
245
+ displacement: undefined,
246
+ isAfterDraggedBlocks: false,
247
+ isNesting: false,
248
+ } );
249
+ } );
250
+
251
+ it( 'should return all undefined values if the block is dragged', () => {
252
+ const result = getDragDisplacementValues( {
253
+ blockIndexes,
254
+ blockDropTargetIndex: 3,
255
+ blockDropPosition: 'bottom',
256
+ clientId: 'block-h',
257
+ firstDraggedBlockIndex: 7,
258
+ isDragged: true,
259
+ } );
260
+
261
+ expect( result ).toEqual( {
262
+ displacement: undefined,
263
+ isAfterDraggedBlocks: undefined,
264
+ isNesting: undefined,
265
+ } );
266
+ } );
267
+ } );
@@ -0,0 +1,29 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useMemo } from '@wordpress/element';
5
+
6
+ export default function useListViewBlockIndexes( blocks ) {
7
+ const blockIndexes = useMemo( () => {
8
+ const indexes = {};
9
+
10
+ let currentGlobalIndex = 0;
11
+
12
+ const traverseBlocks = ( blockList ) => {
13
+ blockList.forEach( ( block ) => {
14
+ indexes[ block.clientId ] = currentGlobalIndex;
15
+ currentGlobalIndex++;
16
+
17
+ if ( block.innerBlocks.length > 0 ) {
18
+ traverseBlocks( block.innerBlocks );
19
+ }
20
+ } );
21
+ };
22
+
23
+ traverseBlocks( blocks );
24
+
25
+ return indexes;
26
+ }, [ blocks ] );
27
+
28
+ return blockIndexes;
29
+ }
@@ -2,10 +2,11 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { useSelect } from '@wordpress/data';
5
- import { useState, useCallback } from '@wordpress/element';
5
+ import { useState, useCallback, useEffect } from '@wordpress/element';
6
6
  import {
7
7
  useThrottle,
8
8
  __experimentalUseDropZone as useDropZone,
9
+ usePrevious,
9
10
  } from '@wordpress/compose';
10
11
  import { isRTL } from '@wordpress/i18n';
11
12
 
@@ -304,6 +305,7 @@ export function getListViewDropTarget( blocksData, position, rtl = false ) {
304
305
 
305
306
  return {
306
307
  rootClientId: candidateBlockData.clientId,
308
+ clientId: candidateBlockData.clientId,
307
309
  blockIndex: newBlockIndex,
308
310
  dropPosition: 'inside',
309
311
  };
@@ -396,15 +398,30 @@ export function getListViewDropTarget( blocksData, position, rtl = false ) {
396
398
  };
397
399
  }
398
400
 
401
+ // Throttle options need to be defined outside of the hook to avoid
402
+ // re-creating the object on every render. This is due to a limitation
403
+ // of the `useThrottle` hook, where the options object is included
404
+ // in the dependency array for memoization.
405
+ const EXPAND_THROTTLE_OPTIONS = {
406
+ leading: false, // Don't call the function immediately on the first call.
407
+ trailing: true, // Do call the function on the last call.
408
+ };
409
+
399
410
  /**
400
411
  * A react hook for implementing a drop zone in list view.
401
412
  *
402
- * @param {Object} props Named parameters.
403
- * @param {?HTMLElement} [props.dropZoneElement] Optional element to be used as the drop zone.
413
+ * @param {Object} props Named parameters.
414
+ * @param {?HTMLElement} [props.dropZoneElement] Optional element to be used as the drop zone.
415
+ * @param {Object} [props.expandedState] The expanded state of the blocks in the list view.
416
+ * @param {Function} [props.setExpandedState] Function to set the expanded state of a list of block clientIds.
404
417
  *
405
418
  * @return {WPListViewDropZoneTarget} The drop target.
406
419
  */
407
- export default function useListViewDropZone( { dropZoneElement } ) {
420
+ export default function useListViewDropZone( {
421
+ dropZoneElement,
422
+ expandedState,
423
+ setExpandedState,
424
+ } ) {
408
425
  const {
409
426
  getBlockRootClientId,
410
427
  getBlockIndex,
@@ -420,6 +437,55 @@ export default function useListViewDropZone( { dropZoneElement } ) {
420
437
 
421
438
  const rtl = isRTL();
422
439
 
440
+ const previousRootClientId = usePrevious( targetRootClientId );
441
+
442
+ const maybeExpandBlock = useCallback(
443
+ ( _expandedState, _target ) => {
444
+ // If the user is attempting to drop a block inside a collapsed block,
445
+ // that is, using a nesting gesture flagged by 'inside' dropPosition,
446
+ // expand the block within the list view, if it isn't already.
447
+ const { rootClientId } = _target || {};
448
+ if ( ! rootClientId ) {
449
+ return;
450
+ }
451
+ if (
452
+ _target?.dropPosition === 'inside' &&
453
+ ! _expandedState[ rootClientId ]
454
+ ) {
455
+ setExpandedState( {
456
+ type: 'expand',
457
+ clientIds: [ rootClientId ],
458
+ } );
459
+ }
460
+ },
461
+ [ setExpandedState ]
462
+ );
463
+
464
+ // Throttle the maybeExpandBlock function to avoid expanding the block
465
+ // too quickly when the user is dragging over the block. This is to
466
+ // avoid expanding the block when the user is just passing over it.
467
+ const throttledMaybeExpandBlock = useThrottle(
468
+ maybeExpandBlock,
469
+ 500,
470
+ EXPAND_THROTTLE_OPTIONS
471
+ );
472
+
473
+ useEffect( () => {
474
+ if (
475
+ target?.dropPosition !== 'inside' ||
476
+ previousRootClientId !== target?.rootClientId
477
+ ) {
478
+ throttledMaybeExpandBlock.cancel();
479
+ return;
480
+ }
481
+ throttledMaybeExpandBlock( expandedState, target );
482
+ }, [
483
+ expandedState,
484
+ previousRootClientId,
485
+ target,
486
+ throttledMaybeExpandBlock,
487
+ ] );
488
+
423
489
  const draggedBlockClientIds = getDraggedBlockClientIds();
424
490
  const throttled = useThrottle(
425
491
  useCallback(
@@ -484,7 +550,7 @@ export default function useListViewDropZone( { dropZoneElement } ) {
484
550
  rtl,
485
551
  ]
486
552
  ),
487
- 200
553
+ 50
488
554
  );
489
555
 
490
556
  const ref = useDropZone( {
@@ -496,6 +562,9 @@ export default function useListViewDropZone( { dropZoneElement } ) {
496
562
  },
497
563
  onDragLeave() {
498
564
  throttled.cancel();
565
+ // Use `null` value to indicate that the drop target is not valid,
566
+ // but that the drag is still active. This allows for styling rules
567
+ // that are active only when a user drags outside of the list view.
499
568
  setTarget( null );
500
569
  },
501
570
  onDragOver( event ) {
@@ -506,7 +575,10 @@ export default function useListViewDropZone( { dropZoneElement } ) {
506
575
  },
507
576
  onDragEnd() {
508
577
  throttled.cancel();
509
- setTarget( null );
578
+ // Use `undefined` value to indicate that the drag has concluded.
579
+ // This allows styling rules that are active only when a user is
580
+ // dragging to be removed.
581
+ setTarget( undefined );
510
582
  },
511
583
  } );
512
584
 
@@ -93,3 +93,119 @@ export function focusListItem( focusClientId, treeGridElementRef ) {
93
93
  } );
94
94
  }
95
95
  }
96
+
97
+ /**
98
+ * Get values for the block that flag whether the block should be displaced up or down,
99
+ * whether the block is being nested, and whether the block appears after the dragged
100
+ * blocks. These values are used to determine the class names to apply to the block.
101
+ * The list view rows are displaced visually via CSS rules. Displacement rules:
102
+ * - `normal`: no displacement — used to apply a translateY of `0` so that the block
103
+ * appears in its original position, and moves to that position smoothly when dragging
104
+ * outside of the list view area.
105
+ * - `up`: the block should be displaced up, creating room beneath the block for the drop indicator.
106
+ * - `down`: the block should be displaced down, creating room above the block for the drop indicator.
107
+ *
108
+ * @param {Object} props
109
+ * @param {Object} props.blockIndexes The indexes of all the blocks in the list view, keyed by clientId.
110
+ * @param {number|null|undefined} props.blockDropTargetIndex The index of the block that the user is dropping to.
111
+ * @param {?string} props.blockDropPosition The position relative to the block that the user is dropping to.
112
+ * @param {string} props.clientId The client id for the current block.
113
+ * @param {?number} props.firstDraggedBlockIndex The index of the first dragged block.
114
+ * @param {?boolean} props.isDragged Whether the current block is being dragged. Dragged blocks skip displacement.
115
+ * @return {Object} An object containing the `displacement`, `isAfterDraggedBlocks` and `isNesting` values.
116
+ */
117
+ export function getDragDisplacementValues( {
118
+ blockIndexes,
119
+ blockDropTargetIndex,
120
+ blockDropPosition,
121
+ clientId,
122
+ firstDraggedBlockIndex,
123
+ isDragged,
124
+ } ) {
125
+ let displacement;
126
+ let isNesting;
127
+ let isAfterDraggedBlocks;
128
+
129
+ if ( ! isDragged ) {
130
+ isNesting = false;
131
+ const thisBlockIndex = blockIndexes[ clientId ];
132
+ isAfterDraggedBlocks = thisBlockIndex > firstDraggedBlockIndex;
133
+
134
+ // Determine where to displace the position of the current block, relative
135
+ // to the blocks being dragged (in their original position) and the drop target
136
+ // (the position where a user is currently dragging the blocks to).
137
+ if (
138
+ blockDropTargetIndex !== undefined &&
139
+ blockDropTargetIndex !== null &&
140
+ firstDraggedBlockIndex !== undefined
141
+ ) {
142
+ // If the block is being dragged and there is a valid drop target,
143
+ // determine if the block being rendered should be displaced up or down.
144
+
145
+ if ( thisBlockIndex !== undefined ) {
146
+ if (
147
+ thisBlockIndex >= firstDraggedBlockIndex &&
148
+ thisBlockIndex < blockDropTargetIndex
149
+ ) {
150
+ // If the current block appears after the set of dragged blocks
151
+ // (in their original position), but is before the drop target,
152
+ // then the current block should be displaced up.
153
+ displacement = 'up';
154
+ } else if (
155
+ thisBlockIndex < firstDraggedBlockIndex &&
156
+ thisBlockIndex >= blockDropTargetIndex
157
+ ) {
158
+ // If the current block appears before the set of dragged blocks
159
+ // (in their original position), but is after the drop target,
160
+ // then the current block should be displaced down.
161
+ displacement = 'down';
162
+ } else {
163
+ displacement = 'normal';
164
+ }
165
+ isNesting =
166
+ typeof blockDropTargetIndex === 'number' &&
167
+ blockDropTargetIndex - 1 === thisBlockIndex &&
168
+ blockDropPosition === 'inside';
169
+ }
170
+ } else if (
171
+ blockDropTargetIndex === null &&
172
+ firstDraggedBlockIndex !== undefined
173
+ ) {
174
+ // A `null` value for `blockDropTargetIndex` indicates that the
175
+ // drop target is outside of the valid areas within the list view.
176
+ // In this case, the drag is still active, but as there is no
177
+ // valid drop target, we should remove the gap indicating where
178
+ // the block would be inserted.
179
+ if (
180
+ thisBlockIndex !== undefined &&
181
+ thisBlockIndex >= firstDraggedBlockIndex
182
+ ) {
183
+ displacement = 'up';
184
+ } else {
185
+ displacement = 'normal';
186
+ }
187
+ } else if (
188
+ blockDropTargetIndex !== undefined &&
189
+ blockDropTargetIndex !== null &&
190
+ firstDraggedBlockIndex === undefined
191
+ ) {
192
+ // If the blockdrop target is defined, but there are no dragged blocks,
193
+ // then the block should be displaced relative to the drop target.
194
+ if ( thisBlockIndex !== undefined ) {
195
+ if ( thisBlockIndex < blockDropTargetIndex ) {
196
+ displacement = 'normal';
197
+ } else {
198
+ displacement = 'down';
199
+ }
200
+ }
201
+ } else if ( blockDropTargetIndex === null ) {
202
+ displacement = 'normal';
203
+ }
204
+ }
205
+
206
+ return {
207
+ displacement,
208
+ isNesting,
209
+ isAfterDraggedBlocks,
210
+ };
211
+ }
@@ -46,7 +46,9 @@ export const ExperimentalBlockEditorProvider = withRegistryProvider(
46
46
 
47
47
  return (
48
48
  <SlotFillProvider passthrough>
49
- <KeyboardShortcuts.Register />
49
+ { ! settings.__unstableIsPreviewMode && (
50
+ <KeyboardShortcuts.Register />
51
+ ) }
50
52
  <BlockRefsProvider>{ children }</BlockRefsProvider>
51
53
  </SlotFillProvider>
52
54
  );
@@ -11,8 +11,8 @@ To help with detecting infinite loops on the client, the `RecursionProvider` com
11
11
  * WordPress dependencies
12
12
  */
13
13
  import {
14
- __experimentalRecursionProvider as RecursionProvider,
15
- __experimentalUseHasRecursion as useHasRecursion,
14
+ RecursionProvider,
15
+ useHasRecursion,
16
16
  useBlockProps,
17
17
  Warning,
18
18
  } from '@wordpress/block-editor';
@@ -2,6 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { createContext, useContext, useMemo } from '@wordpress/element';
5
+ import deprecated from '@wordpress/deprecated';
5
6
 
6
7
  /**
7
8
  * Internal dependencies
@@ -82,3 +83,19 @@ export function useHasRecursion( uniqueId, blockName = '' ) {
82
83
  blockName = blockName || name;
83
84
  return Boolean( previouslyRenderedBlocks[ blockName ]?.has( uniqueId ) );
84
85
  }
86
+
87
+ export const DeprecatedExperimentalRecursionProvider = ( props ) => {
88
+ deprecated( 'wp.blockEditor.__experimentalRecursionProvider', {
89
+ since: '6.5',
90
+ alternative: 'wp.blockEditor.RecursionProvider',
91
+ } );
92
+ return <RecursionProvider { ...props } />;
93
+ };
94
+
95
+ export const DeprecatedExperimentalUseHasRecursion = ( props ) => {
96
+ deprecated( 'wp.blockEditor.__experimentalUseHasRecursion', {
97
+ since: '6.5',
98
+ alternative: 'wp.blockEditor.useHasRecursion',
99
+ } );
100
+ return useHasRecursion( ...props );
101
+ };