@wordpress/block-editor 12.17.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 (401) hide show
  1. package/CHANGELOG.md +4 -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-lock/toolbar.js +8 -2
  24. package/build/components/block-lock/toolbar.js.map +1 -1
  25. package/build/components/block-popover/inbetween.js +15 -3
  26. package/build/components/block-popover/inbetween.js.map +1 -1
  27. package/build/components/block-preview/auto.js +1 -1
  28. package/build/components/block-preview/auto.js.map +1 -1
  29. package/build/components/block-removal-warning-modal/index.js +3 -2
  30. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  31. package/build/components/block-settings-menu/block-settings-dropdown.js +2 -4
  32. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  33. package/build/components/block-switcher/block-transformations-menu.js +12 -1
  34. package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
  35. package/build/components/block-switcher/index.js +119 -90
  36. package/build/components/block-switcher/index.js.map +1 -1
  37. package/build/components/block-tools/insertion-point.js +10 -3
  38. package/build/components/block-tools/insertion-point.js.map +1 -1
  39. package/build/components/font-sizes/fluid-utils.js +7 -1
  40. package/build/components/font-sizes/fluid-utils.js.map +1 -1
  41. package/build/components/global-styles/border-panel.js +5 -14
  42. package/build/components/global-styles/border-panel.js.map +1 -1
  43. package/build/components/global-styles/effects-panel.js +7 -1
  44. package/build/components/global-styles/effects-panel.js.map +1 -1
  45. package/build/components/global-styles/hooks.js +3 -2
  46. package/build/components/global-styles/hooks.js.map +1 -1
  47. package/build/components/global-styles/typography-panel.js +31 -14
  48. package/build/components/global-styles/typography-panel.js.map +1 -1
  49. package/build/components/iframe/get-compatibility-styles.js +99 -0
  50. package/build/components/iframe/get-compatibility-styles.js.map +1 -0
  51. package/build/components/iframe/index.js +2 -3
  52. package/build/components/iframe/index.js.map +1 -1
  53. package/build/components/index.js +16 -2
  54. package/build/components/index.js.map +1 -1
  55. package/build/components/index.native.js +16 -2
  56. package/build/components/index.native.js.map +1 -1
  57. package/build/components/inspector-controls/groups.js +2 -0
  58. package/build/components/inspector-controls/groups.js.map +1 -1
  59. package/build/components/inspector-controls-tabs/styles-tab.js +3 -0
  60. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  61. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +3 -2
  62. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  63. package/build/components/link-control/link-preview.js +30 -26
  64. package/build/components/link-control/link-preview.js.map +1 -1
  65. package/build/components/link-control/search-input.js +1 -9
  66. package/build/components/link-control/search-input.js.map +1 -1
  67. package/build/components/list-view/block-contents.js +3 -1
  68. package/build/components/list-view/block-contents.js.map +1 -1
  69. package/build/components/list-view/block.js +10 -1
  70. package/build/components/list-view/block.js.map +1 -1
  71. package/build/components/list-view/branch.js +29 -8
  72. package/build/components/list-view/branch.js.map +1 -1
  73. package/build/components/list-view/drop-indicator.js +100 -32
  74. package/build/components/list-view/drop-indicator.js.map +1 -1
  75. package/build/components/list-view/index.js +52 -4
  76. package/build/components/list-view/index.js.map +1 -1
  77. package/build/components/list-view/leaf.js +2 -2
  78. package/build/components/list-view/leaf.js.map +1 -1
  79. package/build/components/list-view/use-list-view-block-indexes.js +30 -0
  80. package/build/components/list-view/use-list-view-block-indexes.js.map +1 -0
  81. package/build/components/list-view/use-list-view-drop-zone.js +56 -5
  82. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  83. package/build/components/list-view/utils.js +92 -0
  84. package/build/components/list-view/utils.js.map +1 -1
  85. package/build/components/provider/index.js +1 -1
  86. package/build/components/provider/index.js.map +1 -1
  87. package/build/components/recursion-provider/index.js +21 -0
  88. package/build/components/recursion-provider/index.js.map +1 -1
  89. package/build/components/rich-text/index.js +30 -6
  90. package/build/components/rich-text/index.js.map +1 -1
  91. package/build/components/rich-text/native/index.native.js +9 -9
  92. package/build/components/rich-text/native/index.native.js.map +1 -1
  93. package/build/components/use-block-drop-zone/index.js +30 -7
  94. package/build/components/use-block-drop-zone/index.js.map +1 -1
  95. package/build/components/use-on-block-drop/index.js +50 -8
  96. package/build/components/use-on-block-drop/index.js.map +1 -1
  97. package/build/hooks/block-hooks.js +5 -14
  98. package/build/hooks/block-hooks.js.map +1 -1
  99. package/build/hooks/content-lock-ui.js +17 -42
  100. package/build/hooks/content-lock-ui.js.map +1 -1
  101. package/build/hooks/effects.js +66 -0
  102. package/build/hooks/effects.js.map +1 -0
  103. package/build/hooks/index.js +15 -2
  104. package/build/hooks/index.js.map +1 -1
  105. package/build/hooks/index.native.js +13 -0
  106. package/build/hooks/index.native.js.map +1 -1
  107. package/build/hooks/style.js +6 -2
  108. package/build/hooks/style.js.map +1 -1
  109. package/build/hooks/supports.js +2 -1
  110. package/build/hooks/supports.js.map +1 -1
  111. package/build/hooks/typography.native.js +2 -2
  112. package/build/hooks/typography.native.js.map +1 -1
  113. package/build/hooks/use-bindings-attributes.js +115 -0
  114. package/build/hooks/use-bindings-attributes.js.map +1 -0
  115. package/build/hooks/use-shadow-props.js +46 -0
  116. package/build/hooks/use-shadow-props.js.map +1 -0
  117. package/build/hooks/utils.js +11 -7
  118. package/build/hooks/utils.js.map +1 -1
  119. package/build/index.js +14 -0
  120. package/build/index.js.map +1 -1
  121. package/build/store/actions.js +10 -6
  122. package/build/store/actions.js.map +1 -1
  123. package/build/store/index.js +2 -0
  124. package/build/store/index.js.map +1 -1
  125. package/build/store/private-actions.js +37 -0
  126. package/build/store/private-actions.js.map +1 -1
  127. package/build/store/private-selectors.js +60 -9
  128. package/build/store/private-selectors.js.map +1 -1
  129. package/build/store/reducer.js +44 -3
  130. package/build/store/reducer.js.map +1 -1
  131. package/build/store/resolvers.js +27 -0
  132. package/build/store/resolvers.js.map +1 -0
  133. package/build/store/selectors.js +94 -56
  134. package/build/store/selectors.js.map +1 -1
  135. package/build/store/utils.js +5 -26
  136. package/build/store/utils.js.map +1 -1
  137. package/build/utils/index.js +0 -16
  138. package/build/utils/index.js.map +1 -1
  139. package/build/utils/math.js +13 -0
  140. package/build/utils/math.js.map +1 -1
  141. package/build/utils/object.js +17 -0
  142. package/build/utils/object.js.map +1 -1
  143. package/build/utils/transform-styles/index.js +37 -27
  144. package/build/utils/transform-styles/index.js.map +1 -1
  145. package/build-module/components/block-draggable/index.js +11 -3
  146. package/build-module/components/block-draggable/index.js.map +1 -1
  147. package/build-module/components/block-edit/context.js +1 -0
  148. package/build-module/components/block-edit/context.js.map +1 -1
  149. package/build-module/components/block-edit/index.js +5 -3
  150. package/build-module/components/block-edit/index.js.map +1 -1
  151. package/build-module/components/block-editing-mode/index.js +7 -4
  152. package/build-module/components/block-editing-mode/index.js.map +1 -1
  153. package/build-module/components/block-inspector/index.js +5 -2
  154. package/build-module/components/block-inspector/index.js.map +1 -1
  155. package/build-module/components/block-list/block.js +6 -5
  156. package/build-module/components/block-list/block.js.map +1 -1
  157. package/build-module/components/block-list/block.native.js +11 -7
  158. package/build-module/components/block-list/block.native.js.map +1 -1
  159. package/build-module/components/block-list/index.js +31 -5
  160. package/build-module/components/block-list/index.js.map +1 -1
  161. package/build-module/components/block-list/private-block-context.js +1 -1
  162. package/build-module/components/block-list/private-block-context.js.map +1 -1
  163. package/build-module/components/block-list/use-in-between-inserter.js +1 -1
  164. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  165. package/build-module/components/block-lock/toolbar.js +8 -2
  166. package/build-module/components/block-lock/toolbar.js.map +1 -1
  167. package/build-module/components/block-popover/inbetween.js +15 -3
  168. package/build-module/components/block-popover/inbetween.js.map +1 -1
  169. package/build-module/components/block-preview/auto.js +3 -3
  170. package/build-module/components/block-preview/auto.js.map +1 -1
  171. package/build-module/components/block-removal-warning-modal/index.js +3 -2
  172. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  173. package/build-module/components/block-settings-menu/block-settings-dropdown.js +2 -4
  174. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  175. package/build-module/components/block-switcher/block-transformations-menu.js +12 -1
  176. package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
  177. package/build-module/components/block-switcher/index.js +116 -86
  178. package/build-module/components/block-switcher/index.js.map +1 -1
  179. package/build-module/components/block-tools/insertion-point.js +10 -3
  180. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  181. package/build-module/components/font-sizes/fluid-utils.js +7 -1
  182. package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
  183. package/build-module/components/global-styles/border-panel.js +5 -14
  184. package/build-module/components/global-styles/border-panel.js.map +1 -1
  185. package/build-module/components/global-styles/effects-panel.js +7 -1
  186. package/build-module/components/global-styles/effects-panel.js.map +1 -1
  187. package/build-module/components/global-styles/hooks.js +3 -2
  188. package/build-module/components/global-styles/hooks.js.map +1 -1
  189. package/build-module/components/global-styles/typography-panel.js +32 -15
  190. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  191. package/build-module/components/iframe/get-compatibility-styles.js +93 -0
  192. package/build-module/components/iframe/get-compatibility-styles.js.map +1 -0
  193. package/build-module/components/iframe/index.js +2 -3
  194. package/build-module/components/iframe/index.js.map +1 -1
  195. package/build-module/components/index.js +1 -1
  196. package/build-module/components/index.js.map +1 -1
  197. package/build-module/components/index.native.js +1 -1
  198. package/build-module/components/index.native.js.map +1 -1
  199. package/build-module/components/inspector-controls/groups.js +2 -0
  200. package/build-module/components/inspector-controls/groups.js.map +1 -1
  201. package/build-module/components/inspector-controls-tabs/styles-tab.js +3 -0
  202. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  203. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +3 -2
  204. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  205. package/build-module/components/link-control/link-preview.js +32 -28
  206. package/build-module/components/link-control/link-preview.js.map +1 -1
  207. package/build-module/components/link-control/search-input.js +1 -8
  208. package/build-module/components/link-control/search-input.js.map +1 -1
  209. package/build-module/components/list-view/block-contents.js +3 -1
  210. package/build-module/components/list-view/block-contents.js.map +1 -1
  211. package/build-module/components/list-view/block.js +10 -1
  212. package/build-module/components/list-view/block.js.map +1 -1
  213. package/build-module/components/list-view/branch.js +30 -9
  214. package/build-module/components/list-view/branch.js.map +1 -1
  215. package/build-module/components/list-view/drop-indicator.js +99 -32
  216. package/build-module/components/list-view/drop-indicator.js.map +1 -1
  217. package/build-module/components/list-view/index.js +54 -6
  218. package/build-module/components/list-view/index.js.map +1 -1
  219. package/build-module/components/list-view/leaf.js +2 -2
  220. package/build-module/components/list-view/leaf.js.map +1 -1
  221. package/build-module/components/list-view/use-list-view-block-indexes.js +23 -0
  222. package/build-module/components/list-view/use-list-view-block-indexes.js.map +1 -0
  223. package/build-module/components/list-view/use-list-view-drop-zone.js +58 -7
  224. package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
  225. package/build-module/components/list-view/utils.js +91 -0
  226. package/build-module/components/list-view/utils.js.map +1 -1
  227. package/build-module/components/provider/index.js +1 -1
  228. package/build-module/components/provider/index.js.map +1 -1
  229. package/build-module/components/recursion-provider/index.js +17 -0
  230. package/build-module/components/recursion-provider/index.js.map +1 -1
  231. package/build-module/components/rich-text/index.js +30 -6
  232. package/build-module/components/rich-text/index.js.map +1 -1
  233. package/build-module/components/rich-text/native/index.native.js +9 -9
  234. package/build-module/components/rich-text/native/index.native.js.map +1 -1
  235. package/build-module/components/use-block-drop-zone/index.js +31 -8
  236. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  237. package/build-module/components/use-on-block-drop/index.js +51 -9
  238. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  239. package/build-module/hooks/block-hooks.js +5 -14
  240. package/build-module/hooks/block-hooks.js.map +1 -1
  241. package/build-module/hooks/content-lock-ui.js +19 -43
  242. package/build-module/hooks/content-lock-ui.js.map +1 -1
  243. package/build-module/hooks/effects.js +51 -0
  244. package/build-module/hooks/effects.js.map +1 -0
  245. package/build-module/hooks/index.js +3 -2
  246. package/build-module/hooks/index.js.map +1 -1
  247. package/build-module/hooks/index.native.js +1 -0
  248. package/build-module/hooks/index.native.js.map +1 -1
  249. package/build-module/hooks/style.js +6 -2
  250. package/build-module/hooks/style.js.map +1 -1
  251. package/build-module/hooks/supports.js +2 -1
  252. package/build-module/hooks/supports.js.map +1 -1
  253. package/build-module/hooks/typography.native.js +2 -2
  254. package/build-module/hooks/typography.native.js.map +1 -1
  255. package/build-module/hooks/use-bindings-attributes.js +112 -0
  256. package/build-module/hooks/use-bindings-attributes.js.map +1 -0
  257. package/build-module/hooks/use-shadow-props.js +39 -0
  258. package/build-module/hooks/use-shadow-props.js.map +1 -0
  259. package/build-module/hooks/utils.js +13 -9
  260. package/build-module/hooks/utils.js.map +1 -1
  261. package/build-module/index.js +1 -1
  262. package/build-module/index.js.map +1 -1
  263. package/build-module/store/actions.js +10 -6
  264. package/build-module/store/actions.js.map +1 -1
  265. package/build-module/store/index.js +2 -0
  266. package/build-module/store/index.js.map +1 -1
  267. package/build-module/store/private-actions.js +35 -0
  268. package/build-module/store/private-actions.js.map +1 -1
  269. package/build-module/store/private-selectors.js +53 -8
  270. package/build-module/store/private-selectors.js.map +1 -1
  271. package/build-module/store/reducer.js +43 -3
  272. package/build-module/store/reducer.js.map +1 -1
  273. package/build-module/store/resolvers.js +20 -0
  274. package/build-module/store/resolvers.js.map +1 -0
  275. package/build-module/store/selectors.js +89 -52
  276. package/build-module/store/selectors.js.map +1 -1
  277. package/build-module/store/utils.js +3 -23
  278. package/build-module/store/utils.js.map +1 -1
  279. package/build-module/utils/index.js +0 -1
  280. package/build-module/utils/index.js.map +1 -1
  281. package/build-module/utils/math.js +12 -0
  282. package/build-module/utils/math.js.map +1 -1
  283. package/build-module/utils/object.js +16 -0
  284. package/build-module/utils/object.js.map +1 -1
  285. package/build-module/utils/transform-styles/index.js +36 -27
  286. package/build-module/utils/transform-styles/index.js.map +1 -1
  287. package/build-style/content-rtl.css +33 -16
  288. package/build-style/content.css +33 -16
  289. package/build-style/default-editor-styles-rtl.css +1 -1
  290. package/build-style/default-editor-styles.css +1 -1
  291. package/build-style/style-rtl.css +169 -114
  292. package/build-style/style.css +169 -114
  293. package/package.json +31 -31
  294. package/src/components/block-canvas/style.scss +8 -1
  295. package/src/components/block-draggable/index.js +16 -5
  296. package/src/components/block-edit/context.js +1 -0
  297. package/src/components/block-edit/index.js +4 -0
  298. package/src/components/block-editing-mode/index.js +12 -7
  299. package/src/components/block-inspector/index.js +5 -2
  300. package/src/components/block-list/block.js +5 -4
  301. package/src/components/block-list/block.native.js +13 -3
  302. package/src/components/block-list/content.scss +34 -5
  303. package/src/components/block-list/index.js +52 -16
  304. package/src/components/block-list/private-block-context.js +1 -1
  305. package/src/components/block-list/use-in-between-inserter.js +1 -2
  306. package/src/components/block-lock/toolbar.js +10 -2
  307. package/src/components/block-popover/inbetween.js +22 -2
  308. package/src/components/block-preview/auto.js +3 -3
  309. package/src/components/block-removal-warning-modal/index.js +3 -2
  310. package/src/components/block-settings-menu/block-settings-dropdown.js +2 -7
  311. package/src/components/block-switcher/block-transformations-menu.js +18 -1
  312. package/src/components/block-switcher/index.js +133 -111
  313. package/src/components/block-switcher/style.scss +6 -4
  314. package/src/components/block-switcher/test/index.js +113 -230
  315. package/src/components/block-toolbar/style.scss +22 -18
  316. package/src/components/block-tools/insertion-point.js +15 -2
  317. package/src/components/block-tools/style.scss +8 -7
  318. package/src/components/font-sizes/fluid-utils.js +8 -2
  319. package/src/components/font-sizes/test/fluid-utils.js +9 -0
  320. package/src/components/global-styles/border-panel.js +7 -17
  321. package/src/components/global-styles/effects-panel.js +16 -1
  322. package/src/components/global-styles/hooks.js +2 -0
  323. package/src/components/global-styles/typography-panel.js +45 -13
  324. package/src/components/iframe/get-compatibility-styles.js +120 -0
  325. package/src/components/iframe/index.js +2 -3
  326. package/src/components/index.js +4 -2
  327. package/src/components/index.native.js +4 -2
  328. package/src/components/inspector-controls/groups.js +2 -0
  329. package/src/components/inspector-controls-tabs/styles-tab.js +1 -0
  330. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +2 -0
  331. package/src/components/link-control/link-preview.js +31 -55
  332. package/src/components/link-control/search-input.js +1 -9
  333. package/src/components/link-control/style.scss +31 -85
  334. package/src/components/link-control/test/index.js +2 -1
  335. package/src/components/list-view/block-contents.js +5 -1
  336. package/src/components/list-view/block.js +9 -0
  337. package/src/components/list-view/branch.js +30 -10
  338. package/src/components/list-view/drop-indicator.js +139 -46
  339. package/src/components/list-view/index.js +74 -3
  340. package/src/components/list-view/leaf.js +2 -2
  341. package/src/components/list-view/style.scss +102 -13
  342. package/src/components/list-view/test/use-list-view-drop-zone.js +4 -0
  343. package/src/components/list-view/test/utils.js +218 -1
  344. package/src/components/list-view/use-list-view-block-indexes.js +29 -0
  345. package/src/components/list-view/use-list-view-drop-zone.js +78 -6
  346. package/src/components/list-view/utils.js +116 -0
  347. package/src/components/provider/index.js +3 -1
  348. package/src/components/recursion-provider/README.md +2 -2
  349. package/src/components/recursion-provider/index.js +17 -0
  350. package/src/components/rich-text/index.js +48 -10
  351. package/src/components/rich-text/native/index.native.js +10 -10
  352. package/src/components/use-block-drop-zone/index.js +60 -19
  353. package/src/components/use-block-drop-zone/test/index.js +32 -61
  354. package/src/components/use-on-block-drop/index.js +92 -11
  355. package/src/hooks/block-hooks.js +5 -17
  356. package/src/hooks/content-lock-ui.js +15 -55
  357. package/src/hooks/effects.js +57 -0
  358. package/src/hooks/index.js +2 -2
  359. package/src/hooks/index.native.js +1 -0
  360. package/src/hooks/style.js +8 -0
  361. package/src/hooks/supports.js +2 -0
  362. package/src/hooks/test/effects.js +39 -0
  363. package/src/hooks/typography.native.js +2 -2
  364. package/src/hooks/use-bindings-attributes.js +148 -0
  365. package/src/hooks/use-shadow-props.js +37 -0
  366. package/src/hooks/utils.js +26 -10
  367. package/src/index.js +2 -0
  368. package/src/store/actions.js +9 -4
  369. package/src/store/index.js +2 -0
  370. package/src/store/private-actions.js +32 -0
  371. package/src/store/private-selectors.js +78 -21
  372. package/src/store/reducer.js +49 -2
  373. package/src/store/resolvers.js +17 -0
  374. package/src/store/selectors.js +169 -161
  375. package/src/store/test/registry-selectors.js +431 -0
  376. package/src/store/test/selectors.js +14 -400
  377. package/src/store/utils.js +10 -33
  378. package/src/style.scss +0 -1
  379. package/src/utils/index.js +0 -1
  380. package/src/utils/math.js +12 -0
  381. package/src/utils/object.js +16 -0
  382. package/src/utils/transform-styles/index.js +52 -37
  383. package/tsconfig.tsbuildinfo +1 -1
  384. package/build/components/iframe/use-compatibility-styles.js +0 -100
  385. package/build/components/iframe/use-compatibility-styles.js.map +0 -1
  386. package/build/hooks/custom-fields.js +0 -106
  387. package/build/hooks/custom-fields.js.map +0 -1
  388. package/build/utils/block-variation-transforms.js +0 -42
  389. package/build/utils/block-variation-transforms.js.map +0 -1
  390. package/build-module/components/iframe/use-compatibility-styles.js +0 -94
  391. package/build-module/components/iframe/use-compatibility-styles.js.map +0 -1
  392. package/build-module/hooks/custom-fields.js +0 -99
  393. package/build-module/hooks/custom-fields.js.map +0 -1
  394. package/build-module/utils/block-variation-transforms.js +0 -35
  395. package/build-module/utils/block-variation-transforms.js.map +0 -1
  396. package/src/components/block-switcher/test/__snapshots__/index.js.snap +0 -116
  397. package/src/components/contrast-checker/style.scss +0 -3
  398. package/src/components/iframe/use-compatibility-styles.js +0 -122
  399. package/src/hooks/custom-fields.js +0 -115
  400. package/src/utils/block-variation-transforms.js +0 -38
  401. package/src/utils/test/block-variation-transforms.js +0 -94
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = exports.PrivateListView = exports.BLOCK_LIST_ITEM_HEIGHT = void 0;
8
8
  var _react = require("react");
9
+ var _classnames = _interopRequireDefault(require("classnames"));
9
10
  var _compose = require("@wordpress/compose");
10
11
  var _components = require("@wordpress/components");
11
12
  var _data = require("@wordpress/data");
@@ -16,12 +17,17 @@ var _branch = _interopRequireDefault(require("./branch"));
16
17
  var _context = require("./context");
17
18
  var _dropIndicator = _interopRequireDefault(require("./drop-indicator"));
18
19
  var _useBlockSelection = _interopRequireDefault(require("./use-block-selection"));
20
+ var _useListViewBlockIndexes = _interopRequireDefault(require("./use-list-view-block-indexes"));
19
21
  var _useListViewClientIds = _interopRequireDefault(require("./use-list-view-client-ids"));
20
22
  var _useListViewDropZone = _interopRequireDefault(require("./use-list-view-drop-zone"));
21
23
  var _useListViewExpandSelectedItem = _interopRequireDefault(require("./use-list-view-expand-selected-item"));
22
24
  var _store = require("../../store");
23
25
  var _blockSettingsDropdown = require("../block-settings-menu/block-settings-dropdown");
24
26
  var _utils = require("./utils");
27
+ /**
28
+ * External dependencies
29
+ */
30
+
25
31
  /**
26
32
  * WordPress dependencies
27
33
  */
@@ -94,6 +100,7 @@ function ListViewComponent({
94
100
  blocks,
95
101
  rootClientId
96
102
  });
103
+ const blockIndexes = (0, _useListViewBlockIndexes.default)(clientIdsTree);
97
104
  const {
98
105
  getBlock
99
106
  } = (0, _data.useSelect)(_store.store);
@@ -120,7 +127,9 @@ function ListViewComponent({
120
127
  ref: dropZoneRef,
121
128
  target: blockDropTarget
122
129
  } = (0, _useListViewDropZone.default)({
123
- dropZoneElement
130
+ dropZoneElement,
131
+ expandedState,
132
+ setExpandedState
124
133
  });
125
134
  const elementRef = (0, _element.useRef)();
126
135
  const treeGridRef = (0, _compose.useMergeRefs)([elementRef, dropZoneRef, ref]);
@@ -182,10 +191,43 @@ function ListViewComponent({
182
191
  updateBlockSelection(event, startRow?.dataset?.block, endRow?.dataset?.block);
183
192
  }
184
193
  }, [updateBlockSelection]);
194
+ const firstDraggedBlockClientId = draggedClientIds?.[0];
195
+
196
+ // Convert a blockDropTarget into indexes relative to the blocks in the list view.
197
+ // These values are used to determine which blocks should be displaced to make room
198
+ // for the drop indicator. See `ListViewBranch` and `getDragDisplacementValues`.
199
+ const {
200
+ blockDropTargetIndex,
201
+ blockDropPosition,
202
+ firstDraggedBlockIndex
203
+ } = (0, _element.useMemo)(() => {
204
+ let _blockDropTargetIndex, _firstDraggedBlockIndex;
205
+ if (blockDropTarget?.clientId) {
206
+ const foundBlockIndex = blockIndexes[blockDropTarget.clientId];
207
+ // If dragging below or inside the block, treat the drop target as the next block.
208
+ _blockDropTargetIndex = foundBlockIndex === undefined || blockDropTarget?.dropPosition === 'top' ? foundBlockIndex : foundBlockIndex + 1;
209
+ } else if (blockDropTarget === null) {
210
+ // A `null` value is used to indicate that the user is dragging outside of the list view.
211
+ _blockDropTargetIndex = null;
212
+ }
213
+ if (firstDraggedBlockClientId) {
214
+ const foundBlockIndex = blockIndexes[firstDraggedBlockClientId];
215
+ _firstDraggedBlockIndex = foundBlockIndex === undefined || blockDropTarget?.dropPosition === 'top' ? foundBlockIndex : foundBlockIndex + 1;
216
+ }
217
+ return {
218
+ blockDropTargetIndex: _blockDropTargetIndex,
219
+ blockDropPosition: blockDropTarget?.dropPosition,
220
+ firstDraggedBlockIndex: _firstDraggedBlockIndex
221
+ };
222
+ }, [blockDropTarget, blockIndexes, firstDraggedBlockClientId]);
185
223
  const contextValue = (0, _element.useMemo)(() => ({
224
+ blockDropPosition,
225
+ blockDropTargetIndex,
226
+ blockIndexes,
186
227
  draggedClientIds,
187
228
  expandedState,
188
229
  expand,
230
+ firstDraggedBlockIndex,
189
231
  collapse,
190
232
  BlockSettingsMenu,
191
233
  listViewInstanceId: instanceId,
@@ -194,7 +236,7 @@ function ListViewComponent({
194
236
  setInsertedBlock,
195
237
  treeGridElementRef: elementRef,
196
238
  rootClientId
197
- }), [draggedClientIds, expandedState, expand, collapse, BlockSettingsMenu, instanceId, AdditionalBlockContent, insertedBlock, setInsertedBlock, rootClientId]);
239
+ }), [blockDropPosition, blockDropTargetIndex, blockIndexes, draggedClientIds, expandedState, expand, firstDraggedBlockIndex, collapse, BlockSettingsMenu, instanceId, AdditionalBlockContent, insertedBlock, setInsertedBlock, rootClientId]);
198
240
 
199
241
  // List View renders a fixed number of items and relies on each having a fixed item height of 36px.
200
242
  // If this value changes, we should also change the itemHeight value set in useFixedWindowList.
@@ -218,20 +260,26 @@ function ListViewComponent({
218
260
  return (0, _react.createElement)(_data.AsyncModeProvider, {
219
261
  value: true
220
262
  }, (0, _react.createElement)(_dropIndicator.default, {
263
+ draggedBlockClientId: firstDraggedBlockClientId,
221
264
  listViewRef: elementRef,
222
265
  blockDropTarget: blockDropTarget
223
266
  }), description && (0, _react.createElement)(_components.VisuallyHidden, {
224
267
  id: describedById
225
268
  }, description), (0, _react.createElement)(_components.__experimentalTreeGrid, {
226
269
  id: id,
227
- className: "block-editor-list-view-tree",
270
+ className: (0, _classnames.default)('block-editor-list-view-tree', {
271
+ 'is-dragging': draggedClientIds?.length > 0 && blockDropTargetIndex !== undefined
272
+ }),
228
273
  "aria-label": (0, _i18n.__)('Block navigation structure'),
229
274
  ref: treeGridRef,
230
275
  onCollapseRow: collapseRow,
231
276
  onExpandRow: expandRow,
232
277
  onFocusRow: focusRow,
233
278
  applicationAriaLabel: (0, _i18n.__)('Block navigation structure'),
234
- "aria-describedby": describedById
279
+ "aria-describedby": describedById,
280
+ style: {
281
+ '--wp-admin--list-view-dragged-items-height': draggedClientIds?.length ? `${BLOCK_LIST_ITEM_HEIGHT * (draggedClientIds.length - 1)}px` : null
282
+ }
235
283
  }, (0, _react.createElement)(_context.ListViewContext.Provider, {
236
284
  value: contextValue
237
285
  }, (0, _react.createElement)(_branch.default, {
@@ -1 +1 @@
1
- {"version":3,"names":["_compose","require","_components","_data","_deprecated","_interopRequireDefault","_element","_i18n","_branch","_context","_dropIndicator","_useBlockSelection","_useListViewClientIds","_useListViewDropZone","_useListViewExpandSelectedItem","_store","_blockSettingsDropdown","_utils","expanded","state","action","Array","isArray","clientIds","reduce","newState","id","type","BLOCK_LIST_ITEM_HEIGHT","exports","ListViewComponent","blocks","dropZoneElement","showBlockMovers","isExpanded","showAppender","blockSettingsMenu","BlockSettingsMenu","BlockSettingsDropdown","rootClientId","description","onSelect","additionalBlockContent","AdditionalBlockContent","ref","deprecated","since","alternative","instanceId","useInstanceId","clientIdsTree","draggedClientIds","selectedClientIds","useListViewClientIds","getBlock","useSelect","blockEditorStore","visibleBlockCount","shouldShowInnerBlocks","select","getGlobalBlockCount","getClientIdsOfDescendants","__unstableGetEditorMode","draggedBlockCount","length","updateBlockSelection","useBlockSelection","expandedState","setExpandedState","useReducer","dropZoneRef","target","blockDropTarget","useListViewDropZone","elementRef","useRef","treeGridRef","useMergeRefs","insertedBlock","setInsertedBlock","useState","setSelectedTreeId","useListViewExpandSelectedItem","firstSelectedBlockClientId","selectEditorBlock","useCallback","event","blockClientId","focusPosition","useEffect","focusListItem","expand","clientId","collapse","expandRow","row","dataset","block","collapseRow","focusRow","startRow","endRow","shiftKey","contextValue","useMemo","listViewInstanceId","treeGridElementRef","fixedListWindow","useFixedWindowList","useWindowing","windowOverscan","describedById","_react","createElement","AsyncModeProvider","value","default","listViewRef","VisuallyHidden","__experimentalTreeGrid","className","__","onCollapseRow","onExpandRow","onFocusRow","applicationAriaLabel","ListViewContext","Provider","parentId","selectBlock","PrivateListView","forwardRef","_default","props","undefined"],"sources":["@wordpress/block-editor/src/components/list-view/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseInstanceId,\n\tuseMergeRefs,\n\t__experimentalUseFixedWindowList as useFixedWindowList,\n} from '@wordpress/compose';\nimport {\n\t__experimentalTreeGrid as TreeGrid,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { AsyncModeProvider, useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseReducer,\n\tforwardRef,\n\tuseState,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ListViewBranch from './branch';\nimport { ListViewContext } from './context';\nimport ListViewDropIndicator from './drop-indicator';\nimport useBlockSelection from './use-block-selection';\nimport useListViewClientIds from './use-list-view-client-ids';\nimport useListViewDropZone from './use-list-view-drop-zone';\nimport useListViewExpandSelectedItem from './use-list-view-expand-selected-item';\nimport { store as blockEditorStore } from '../../store';\nimport { BlockSettingsDropdown } from '../block-settings-menu/block-settings-dropdown';\nimport { focusListItem } from './utils';\n\nconst expanded = ( state, action ) => {\n\tif ( Array.isArray( action.clientIds ) ) {\n\t\treturn {\n\t\t\t...state,\n\t\t\t...action.clientIds.reduce(\n\t\t\t\t( newState, id ) => ( {\n\t\t\t\t\t...newState,\n\t\t\t\t\t[ id ]: action.type === 'expand',\n\t\t\t\t} ),\n\t\t\t\t{}\n\t\t\t),\n\t\t};\n\t}\n\treturn state;\n};\n\nexport const BLOCK_LIST_ITEM_HEIGHT = 36;\n\n/** @typedef {import('react').ComponentType} ComponentType */\n/** @typedef {import('react').Ref<HTMLElement>} Ref */\n\n/**\n * Show a hierarchical list of blocks.\n *\n * @param {Object} props Components props.\n * @param {string} props.id An HTML element id for the root element of ListView.\n * @param {Array} props.blocks _deprecated_ Custom subset of block client IDs to be used instead of the default hierarchy.\n * @param {?HTMLElement} props.dropZoneElement Optional element to be used as the drop zone.\n * @param {?boolean} props.showBlockMovers Flag to enable block movers. Defaults to `false`.\n * @param {?boolean} props.isExpanded Flag to determine whether nested levels are expanded by default. Defaults to `false`.\n * @param {?boolean} props.showAppender Flag to show or hide the block appender. Defaults to `false`.\n * @param {?ComponentType} props.blockSettingsMenu Optional more menu substitution. Defaults to the standard `BlockSettingsDropdown` component.\n * @param {string} props.rootClientId The client id of the root block from which we determine the blocks to show in the list.\n * @param {string} props.description Optional accessible description for the tree grid component.\n * @param {?Function} props.onSelect Optional callback to be invoked when a block is selected. Receives the block object that was selected.\n * @param {?ComponentType} props.additionalBlockContent Component that renders additional block content UI.\n * @param {Ref} ref Forwarded ref\n */\nfunction ListViewComponent(\n\t{\n\t\tid,\n\t\tblocks,\n\t\tdropZoneElement,\n\t\tshowBlockMovers = false,\n\t\tisExpanded = false,\n\t\tshowAppender = false,\n\t\tblockSettingsMenu: BlockSettingsMenu = BlockSettingsDropdown,\n\t\trootClientId,\n\t\tdescription,\n\t\tonSelect,\n\t\tadditionalBlockContent: AdditionalBlockContent,\n\t},\n\tref\n) {\n\t// This can be removed once we no longer need to support the blocks prop.\n\tif ( blocks ) {\n\t\tdeprecated(\n\t\t\t'`blocks` property in `wp.blockEditor.__experimentalListView`',\n\t\t\t{\n\t\t\t\tsince: '6.3',\n\t\t\t\talternative: '`rootClientId` property',\n\t\t\t}\n\t\t);\n\t}\n\n\tconst instanceId = useInstanceId( ListViewComponent );\n\tconst { clientIdsTree, draggedClientIds, selectedClientIds } =\n\t\tuseListViewClientIds( { blocks, rootClientId } );\n\n\tconst { getBlock } = useSelect( blockEditorStore );\n\tconst { visibleBlockCount, shouldShowInnerBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetGlobalBlockCount,\n\t\t\t\tgetClientIdsOfDescendants,\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst draggedBlockCount =\n\t\t\t\tdraggedClientIds?.length > 0\n\t\t\t\t\t? getClientIdsOfDescendants( draggedClientIds ).length + 1\n\t\t\t\t\t: 0;\n\t\t\treturn {\n\t\t\t\tvisibleBlockCount: getGlobalBlockCount() - draggedBlockCount,\n\t\t\t\tshouldShowInnerBlocks: __unstableGetEditorMode() !== 'zoom-out',\n\t\t\t};\n\t\t},\n\t\t[ draggedClientIds ]\n\t);\n\n\tconst { updateBlockSelection } = useBlockSelection();\n\n\tconst [ expandedState, setExpandedState ] = useReducer( expanded, {} );\n\n\tconst { ref: dropZoneRef, target: blockDropTarget } = useListViewDropZone( {\n\t\tdropZoneElement,\n\t} );\n\tconst elementRef = useRef();\n\tconst treeGridRef = useMergeRefs( [ elementRef, dropZoneRef, ref ] );\n\n\tconst [ insertedBlock, setInsertedBlock ] = useState( null );\n\n\tconst { setSelectedTreeId } = useListViewExpandSelectedItem( {\n\t\tfirstSelectedBlockClientId: selectedClientIds[ 0 ],\n\t\tsetExpandedState,\n\t} );\n\tconst selectEditorBlock = useCallback(\n\t\t/**\n\t\t * @param {MouseEvent | KeyboardEvent | undefined} event\n\t\t * @param {string} blockClientId\n\t\t * @param {null | undefined | -1 | 1} focusPosition\n\t\t */\n\t\t( event, blockClientId, focusPosition ) => {\n\t\t\tupdateBlockSelection( event, blockClientId, null, focusPosition );\n\t\t\tsetSelectedTreeId( blockClientId );\n\t\t\tif ( onSelect ) {\n\t\t\t\tonSelect( getBlock( blockClientId ) );\n\t\t\t}\n\t\t},\n\t\t[ setSelectedTreeId, updateBlockSelection, onSelect, getBlock ]\n\t);\n\tuseEffect( () => {\n\t\t// If a blocks are already selected when the list view is initially\n\t\t// mounted, shift focus to the first selected block.\n\t\tif ( selectedClientIds?.length ) {\n\t\t\tfocusListItem( selectedClientIds[ 0 ], elementRef );\n\t\t}\n\t\t// Disable reason: Only focus on the selected item when the list view is mounted.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tconst expand = useCallback(\n\t\t( clientId ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetExpandedState( { type: 'expand', clientIds: [ clientId ] } );\n\t\t},\n\t\t[ setExpandedState ]\n\t);\n\tconst collapse = useCallback(\n\t\t( clientId ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetExpandedState( { type: 'collapse', clientIds: [ clientId ] } );\n\t\t},\n\t\t[ setExpandedState ]\n\t);\n\tconst expandRow = useCallback(\n\t\t( row ) => {\n\t\t\texpand( row?.dataset?.block );\n\t\t},\n\t\t[ expand ]\n\t);\n\tconst collapseRow = useCallback(\n\t\t( row ) => {\n\t\t\tcollapse( row?.dataset?.block );\n\t\t},\n\t\t[ collapse ]\n\t);\n\tconst focusRow = useCallback(\n\t\t( event, startRow, endRow ) => {\n\t\t\tif ( event.shiftKey ) {\n\t\t\t\tupdateBlockSelection(\n\t\t\t\t\tevent,\n\t\t\t\t\tstartRow?.dataset?.block,\n\t\t\t\t\tendRow?.dataset?.block\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ updateBlockSelection ]\n\t);\n\n\tconst contextValue = useMemo(\n\t\t() => ( {\n\t\t\tdraggedClientIds,\n\t\t\texpandedState,\n\t\t\texpand,\n\t\t\tcollapse,\n\t\t\tBlockSettingsMenu,\n\t\t\tlistViewInstanceId: instanceId,\n\t\t\tAdditionalBlockContent,\n\t\t\tinsertedBlock,\n\t\t\tsetInsertedBlock,\n\t\t\ttreeGridElementRef: elementRef,\n\t\t\trootClientId,\n\t\t} ),\n\t\t[\n\t\t\tdraggedClientIds,\n\t\t\texpandedState,\n\t\t\texpand,\n\t\t\tcollapse,\n\t\t\tBlockSettingsMenu,\n\t\t\tinstanceId,\n\t\t\tAdditionalBlockContent,\n\t\t\tinsertedBlock,\n\t\t\tsetInsertedBlock,\n\t\t\trootClientId,\n\t\t]\n\t);\n\n\t// List View renders a fixed number of items and relies on each having a fixed item height of 36px.\n\t// If this value changes, we should also change the itemHeight value set in useFixedWindowList.\n\t// See: https://github.com/WordPress/gutenberg/pull/35230 for additional context.\n\tconst [ fixedListWindow ] = useFixedWindowList(\n\t\telementRef,\n\t\tBLOCK_LIST_ITEM_HEIGHT,\n\t\tvisibleBlockCount,\n\t\t{\n\t\t\t// Ensure that the windowing logic is recalculated when the expanded state changes.\n\t\t\t// This is necessary because expanding a collapsed block in a short list view can\n\t\t\t// switch the list view to a tall list view with a scrollbar, and vice versa.\n\t\t\t// When this happens, the windowing logic needs to be recalculated to ensure that\n\t\t\t// the correct number of blocks are rendered, by rechecking for a scroll container.\n\t\t\texpandedState,\n\t\t\tuseWindowing: true,\n\t\t\twindowOverscan: 40,\n\t\t}\n\t);\n\n\t// If there are no blocks to show and we're not showing the appender, do not render the list view.\n\tif ( ! clientIdsTree.length && ! showAppender ) {\n\t\treturn null;\n\t}\n\n\tconst describedById =\n\t\tdescription && `block-editor-list-view-description-${ instanceId }`;\n\n\treturn (\n\t\t<AsyncModeProvider value={ true }>\n\t\t\t<ListViewDropIndicator\n\t\t\t\tlistViewRef={ elementRef }\n\t\t\t\tblockDropTarget={ blockDropTarget }\n\t\t\t/>\n\t\t\t{ description && (\n\t\t\t\t<VisuallyHidden id={ describedById }>\n\t\t\t\t\t{ description }\n\t\t\t\t</VisuallyHidden>\n\t\t\t) }\n\t\t\t<TreeGrid\n\t\t\t\tid={ id }\n\t\t\t\tclassName=\"block-editor-list-view-tree\"\n\t\t\t\taria-label={ __( 'Block navigation structure' ) }\n\t\t\t\tref={ treeGridRef }\n\t\t\t\tonCollapseRow={ collapseRow }\n\t\t\t\tonExpandRow={ expandRow }\n\t\t\t\tonFocusRow={ focusRow }\n\t\t\t\tapplicationAriaLabel={ __( 'Block navigation structure' ) }\n\t\t\t\taria-describedby={ describedById }\n\t\t\t>\n\t\t\t\t<ListViewContext.Provider value={ contextValue }>\n\t\t\t\t\t<ListViewBranch\n\t\t\t\t\t\tblocks={ clientIdsTree }\n\t\t\t\t\t\tparentId={ rootClientId }\n\t\t\t\t\t\tselectBlock={ selectEditorBlock }\n\t\t\t\t\t\tshowBlockMovers={ showBlockMovers }\n\t\t\t\t\t\tfixedListWindow={ fixedListWindow }\n\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\tshouldShowInnerBlocks={ shouldShowInnerBlocks }\n\t\t\t\t\t\tshowAppender={ showAppender }\n\t\t\t\t\t/>\n\t\t\t\t</ListViewContext.Provider>\n\t\t\t</TreeGrid>\n\t\t</AsyncModeProvider>\n\t);\n}\n\n// This is the private API for the ListView component.\n// It allows access to all props, not just the public ones.\nexport const PrivateListView = forwardRef( ListViewComponent );\n\n// This is the public API for the ListView component.\n// We wrap the PrivateListView component to hide some props from the public API.\nexport default forwardRef( ( props, ref ) => {\n\treturn (\n\t\t<PrivateListView\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\tshowAppender={ false }\n\t\t\trootClientId={ null }\n\t\t\tonSelect={ null }\n\t\t\tadditionalBlockContent={ null }\n\t\t\tblockSettingsMenu={ undefined }\n\t\t/>\n\t);\n} );\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AAIA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AASA,IAAAM,KAAA,GAAAN,OAAA;AAKA,IAAAO,OAAA,GAAAH,sBAAA,CAAAJ,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,cAAA,GAAAL,sBAAA,CAAAJ,OAAA;AACA,IAAAU,kBAAA,GAAAN,sBAAA,CAAAJ,OAAA;AACA,IAAAW,qBAAA,GAAAP,sBAAA,CAAAJ,OAAA;AACA,IAAAY,oBAAA,GAAAR,sBAAA,CAAAJ,OAAA;AACA,IAAA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B,EAAGA,iBAAmB;IACvClB,UAAU,EAAGA,UAAY;IACzBwB,qBAAqB,EAAGA,qBAAuB;IAC/CvB,YAAY,EAAGA;EAAc,CAC7B,CACwB,CACjB,CACQ,CAAC;AAEtB;;AAEA;AACA;AACO,MAAM+F,eAAe,GAAG,IAAAC,mBAAU,EAAErG,iBAAkB,CAAC;;AAE9D;AACA;AAAAD,OAAA,CAAAqG,eAAA,GAAAA,eAAA;AAAA,IAAAE,QAAA,GACe,IAAAD,mBAAU,EAAE,CAAEE,KAAK,EAAEzF,GAAG,KAAM;EAC5C,OACC,IAAAoE,MAAA,CAAAC,aAAA,EAACiB,eAAe;IACftF,GAAG,EAAGA,GAAK;IAAA,GACNyF,KAAK;IACVlG,YAAY,EAAG,KAAO;IACtBI,YAAY,EAAG,IAAM;IACrBE,QAAQ,EAAG,IAAM;IACjBC,sBAAsB,EAAG,IAAM;IAC/BN,iBAAiB,EAAGkG;EAAW,CAC/B,CAAC;AAEJ,CAAE,CAAC;AAAAzG,OAAA,CAAAuF,OAAA,GAAAgB,QAAA"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_compose","_components","_data","_deprecated","_element","_i18n","_branch","_context","_dropIndicator","_useBlockSelection","_useListViewBlockIndexes","_useListViewClientIds","_useListViewDropZone","_useListViewExpandSelectedItem","_store","_blockSettingsDropdown","_utils","expanded","state","action","Array","isArray","clientIds","reduce","newState","id","type","BLOCK_LIST_ITEM_HEIGHT","exports","ListViewComponent","blocks","dropZoneElement","showBlockMovers","isExpanded","showAppender","blockSettingsMenu","BlockSettingsMenu","BlockSettingsDropdown","rootClientId","description","onSelect","additionalBlockContent","AdditionalBlockContent","ref","deprecated","since","alternative","instanceId","useInstanceId","clientIdsTree","draggedClientIds","selectedClientIds","useListViewClientIds","blockIndexes","useListViewBlockIndexes","getBlock","useSelect","blockEditorStore","visibleBlockCount","shouldShowInnerBlocks","select","getGlobalBlockCount","getClientIdsOfDescendants","__unstableGetEditorMode","draggedBlockCount","length","updateBlockSelection","useBlockSelection","expandedState","setExpandedState","useReducer","dropZoneRef","target","blockDropTarget","useListViewDropZone","elementRef","useRef","treeGridRef","useMergeRefs","insertedBlock","setInsertedBlock","useState","setSelectedTreeId","useListViewExpandSelectedItem","firstSelectedBlockClientId","selectEditorBlock","useCallback","event","blockClientId","focusPosition","useEffect","focusListItem","expand","clientId","collapse","expandRow","row","dataset","block","collapseRow","focusRow","startRow","endRow","shiftKey","firstDraggedBlockClientId","blockDropTargetIndex","blockDropPosition","firstDraggedBlockIndex","useMemo","_blockDropTargetIndex","_firstDraggedBlockIndex","foundBlockIndex","undefined","dropPosition","contextValue","listViewInstanceId","treeGridElementRef","fixedListWindow","useFixedWindowList","useWindowing","windowOverscan","describedById","_react","createElement","AsyncModeProvider","value","default","draggedBlockClientId","listViewRef","VisuallyHidden","__experimentalTreeGrid","className","classnames","__","onCollapseRow","onExpandRow","onFocusRow","applicationAriaLabel","style","ListViewContext","Provider","parentId","selectBlock","PrivateListView","forwardRef","_default","props"],"sources":["@wordpress/block-editor/src/components/list-view/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseInstanceId,\n\tuseMergeRefs,\n\t__experimentalUseFixedWindowList as useFixedWindowList,\n} from '@wordpress/compose';\nimport {\n\t__experimentalTreeGrid as TreeGrid,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { AsyncModeProvider, useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseReducer,\n\tforwardRef,\n\tuseState,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ListViewBranch from './branch';\nimport { ListViewContext } from './context';\nimport ListViewDropIndicatorPreview from './drop-indicator';\nimport useBlockSelection from './use-block-selection';\nimport useListViewBlockIndexes from './use-list-view-block-indexes';\nimport useListViewClientIds from './use-list-view-client-ids';\nimport useListViewDropZone from './use-list-view-drop-zone';\nimport useListViewExpandSelectedItem from './use-list-view-expand-selected-item';\nimport { store as blockEditorStore } from '../../store';\nimport { BlockSettingsDropdown } from '../block-settings-menu/block-settings-dropdown';\nimport { focusListItem } from './utils';\n\nconst expanded = ( state, action ) => {\n\tif ( Array.isArray( action.clientIds ) ) {\n\t\treturn {\n\t\t\t...state,\n\t\t\t...action.clientIds.reduce(\n\t\t\t\t( newState, id ) => ( {\n\t\t\t\t\t...newState,\n\t\t\t\t\t[ id ]: action.type === 'expand',\n\t\t\t\t} ),\n\t\t\t\t{}\n\t\t\t),\n\t\t};\n\t}\n\treturn state;\n};\n\nexport const BLOCK_LIST_ITEM_HEIGHT = 36;\n\n/** @typedef {import('react').ComponentType} ComponentType */\n/** @typedef {import('react').Ref<HTMLElement>} Ref */\n\n/**\n * Show a hierarchical list of blocks.\n *\n * @param {Object} props Components props.\n * @param {string} props.id An HTML element id for the root element of ListView.\n * @param {Array} props.blocks _deprecated_ Custom subset of block client IDs to be used instead of the default hierarchy.\n * @param {?HTMLElement} props.dropZoneElement Optional element to be used as the drop zone.\n * @param {?boolean} props.showBlockMovers Flag to enable block movers. Defaults to `false`.\n * @param {?boolean} props.isExpanded Flag to determine whether nested levels are expanded by default. Defaults to `false`.\n * @param {?boolean} props.showAppender Flag to show or hide the block appender. Defaults to `false`.\n * @param {?ComponentType} props.blockSettingsMenu Optional more menu substitution. Defaults to the standard `BlockSettingsDropdown` component.\n * @param {string} props.rootClientId The client id of the root block from which we determine the blocks to show in the list.\n * @param {string} props.description Optional accessible description for the tree grid component.\n * @param {?Function} props.onSelect Optional callback to be invoked when a block is selected. Receives the block object that was selected.\n * @param {?ComponentType} props.additionalBlockContent Component that renders additional block content UI.\n * @param {Ref} ref Forwarded ref\n */\nfunction ListViewComponent(\n\t{\n\t\tid,\n\t\tblocks,\n\t\tdropZoneElement,\n\t\tshowBlockMovers = false,\n\t\tisExpanded = false,\n\t\tshowAppender = false,\n\t\tblockSettingsMenu: BlockSettingsMenu = BlockSettingsDropdown,\n\t\trootClientId,\n\t\tdescription,\n\t\tonSelect,\n\t\tadditionalBlockContent: AdditionalBlockContent,\n\t},\n\tref\n) {\n\t// This can be removed once we no longer need to support the blocks prop.\n\tif ( blocks ) {\n\t\tdeprecated(\n\t\t\t'`blocks` property in `wp.blockEditor.__experimentalListView`',\n\t\t\t{\n\t\t\t\tsince: '6.3',\n\t\t\t\talternative: '`rootClientId` property',\n\t\t\t}\n\t\t);\n\t}\n\n\tconst instanceId = useInstanceId( ListViewComponent );\n\tconst { clientIdsTree, draggedClientIds, selectedClientIds } =\n\t\tuseListViewClientIds( { blocks, rootClientId } );\n\tconst blockIndexes = useListViewBlockIndexes( clientIdsTree );\n\n\tconst { getBlock } = useSelect( blockEditorStore );\n\tconst { visibleBlockCount, shouldShowInnerBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetGlobalBlockCount,\n\t\t\t\tgetClientIdsOfDescendants,\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst draggedBlockCount =\n\t\t\t\tdraggedClientIds?.length > 0\n\t\t\t\t\t? getClientIdsOfDescendants( draggedClientIds ).length + 1\n\t\t\t\t\t: 0;\n\t\t\treturn {\n\t\t\t\tvisibleBlockCount: getGlobalBlockCount() - draggedBlockCount,\n\t\t\t\tshouldShowInnerBlocks: __unstableGetEditorMode() !== 'zoom-out',\n\t\t\t};\n\t\t},\n\t\t[ draggedClientIds ]\n\t);\n\n\tconst { updateBlockSelection } = useBlockSelection();\n\n\tconst [ expandedState, setExpandedState ] = useReducer( expanded, {} );\n\n\tconst { ref: dropZoneRef, target: blockDropTarget } = useListViewDropZone( {\n\t\tdropZoneElement,\n\t\texpandedState,\n\t\tsetExpandedState,\n\t} );\n\tconst elementRef = useRef();\n\tconst treeGridRef = useMergeRefs( [ elementRef, dropZoneRef, ref ] );\n\n\tconst [ insertedBlock, setInsertedBlock ] = useState( null );\n\n\tconst { setSelectedTreeId } = useListViewExpandSelectedItem( {\n\t\tfirstSelectedBlockClientId: selectedClientIds[ 0 ],\n\t\tsetExpandedState,\n\t} );\n\tconst selectEditorBlock = useCallback(\n\t\t/**\n\t\t * @param {MouseEvent | KeyboardEvent | undefined} event\n\t\t * @param {string} blockClientId\n\t\t * @param {null | undefined | -1 | 1} focusPosition\n\t\t */\n\t\t( event, blockClientId, focusPosition ) => {\n\t\t\tupdateBlockSelection( event, blockClientId, null, focusPosition );\n\t\t\tsetSelectedTreeId( blockClientId );\n\t\t\tif ( onSelect ) {\n\t\t\t\tonSelect( getBlock( blockClientId ) );\n\t\t\t}\n\t\t},\n\t\t[ setSelectedTreeId, updateBlockSelection, onSelect, getBlock ]\n\t);\n\tuseEffect( () => {\n\t\t// If a blocks are already selected when the list view is initially\n\t\t// mounted, shift focus to the first selected block.\n\t\tif ( selectedClientIds?.length ) {\n\t\t\tfocusListItem( selectedClientIds[ 0 ], elementRef );\n\t\t}\n\t\t// Disable reason: Only focus on the selected item when the list view is mounted.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tconst expand = useCallback(\n\t\t( clientId ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetExpandedState( { type: 'expand', clientIds: [ clientId ] } );\n\t\t},\n\t\t[ setExpandedState ]\n\t);\n\tconst collapse = useCallback(\n\t\t( clientId ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetExpandedState( { type: 'collapse', clientIds: [ clientId ] } );\n\t\t},\n\t\t[ setExpandedState ]\n\t);\n\tconst expandRow = useCallback(\n\t\t( row ) => {\n\t\t\texpand( row?.dataset?.block );\n\t\t},\n\t\t[ expand ]\n\t);\n\tconst collapseRow = useCallback(\n\t\t( row ) => {\n\t\t\tcollapse( row?.dataset?.block );\n\t\t},\n\t\t[ collapse ]\n\t);\n\tconst focusRow = useCallback(\n\t\t( event, startRow, endRow ) => {\n\t\t\tif ( event.shiftKey ) {\n\t\t\t\tupdateBlockSelection(\n\t\t\t\t\tevent,\n\t\t\t\t\tstartRow?.dataset?.block,\n\t\t\t\t\tendRow?.dataset?.block\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ updateBlockSelection ]\n\t);\n\n\tconst firstDraggedBlockClientId = draggedClientIds?.[ 0 ];\n\n\t// Convert a blockDropTarget into indexes relative to the blocks in the list view.\n\t// These values are used to determine which blocks should be displaced to make room\n\t// for the drop indicator. See `ListViewBranch` and `getDragDisplacementValues`.\n\tconst { blockDropTargetIndex, blockDropPosition, firstDraggedBlockIndex } =\n\t\tuseMemo( () => {\n\t\t\tlet _blockDropTargetIndex, _firstDraggedBlockIndex;\n\n\t\t\tif ( blockDropTarget?.clientId ) {\n\t\t\t\tconst foundBlockIndex =\n\t\t\t\t\tblockIndexes[ blockDropTarget.clientId ];\n\t\t\t\t// If dragging below or inside the block, treat the drop target as the next block.\n\t\t\t\t_blockDropTargetIndex =\n\t\t\t\t\tfoundBlockIndex === undefined ||\n\t\t\t\t\tblockDropTarget?.dropPosition === 'top'\n\t\t\t\t\t\t? foundBlockIndex\n\t\t\t\t\t\t: foundBlockIndex + 1;\n\t\t\t} else if ( blockDropTarget === null ) {\n\t\t\t\t// A `null` value is used to indicate that the user is dragging outside of the list view.\n\t\t\t\t_blockDropTargetIndex = null;\n\t\t\t}\n\n\t\t\tif ( firstDraggedBlockClientId ) {\n\t\t\t\tconst foundBlockIndex =\n\t\t\t\t\tblockIndexes[ firstDraggedBlockClientId ];\n\t\t\t\t_firstDraggedBlockIndex =\n\t\t\t\t\tfoundBlockIndex === undefined ||\n\t\t\t\t\tblockDropTarget?.dropPosition === 'top'\n\t\t\t\t\t\t? foundBlockIndex\n\t\t\t\t\t\t: foundBlockIndex + 1;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tblockDropTargetIndex: _blockDropTargetIndex,\n\t\t\t\tblockDropPosition: blockDropTarget?.dropPosition,\n\t\t\t\tfirstDraggedBlockIndex: _firstDraggedBlockIndex,\n\t\t\t};\n\t\t}, [ blockDropTarget, blockIndexes, firstDraggedBlockClientId ] );\n\n\tconst contextValue = useMemo(\n\t\t() => ( {\n\t\t\tblockDropPosition,\n\t\t\tblockDropTargetIndex,\n\t\t\tblockIndexes,\n\t\t\tdraggedClientIds,\n\t\t\texpandedState,\n\t\t\texpand,\n\t\t\tfirstDraggedBlockIndex,\n\t\t\tcollapse,\n\t\t\tBlockSettingsMenu,\n\t\t\tlistViewInstanceId: instanceId,\n\t\t\tAdditionalBlockContent,\n\t\t\tinsertedBlock,\n\t\t\tsetInsertedBlock,\n\t\t\ttreeGridElementRef: elementRef,\n\t\t\trootClientId,\n\t\t} ),\n\t\t[\n\t\t\tblockDropPosition,\n\t\t\tblockDropTargetIndex,\n\t\t\tblockIndexes,\n\t\t\tdraggedClientIds,\n\t\t\texpandedState,\n\t\t\texpand,\n\t\t\tfirstDraggedBlockIndex,\n\t\t\tcollapse,\n\t\t\tBlockSettingsMenu,\n\t\t\tinstanceId,\n\t\t\tAdditionalBlockContent,\n\t\t\tinsertedBlock,\n\t\t\tsetInsertedBlock,\n\t\t\trootClientId,\n\t\t]\n\t);\n\n\t// List View renders a fixed number of items and relies on each having a fixed item height of 36px.\n\t// If this value changes, we should also change the itemHeight value set in useFixedWindowList.\n\t// See: https://github.com/WordPress/gutenberg/pull/35230 for additional context.\n\tconst [ fixedListWindow ] = useFixedWindowList(\n\t\telementRef,\n\t\tBLOCK_LIST_ITEM_HEIGHT,\n\t\tvisibleBlockCount,\n\t\t{\n\t\t\t// Ensure that the windowing logic is recalculated when the expanded state changes.\n\t\t\t// This is necessary because expanding a collapsed block in a short list view can\n\t\t\t// switch the list view to a tall list view with a scrollbar, and vice versa.\n\t\t\t// When this happens, the windowing logic needs to be recalculated to ensure that\n\t\t\t// the correct number of blocks are rendered, by rechecking for a scroll container.\n\t\t\texpandedState,\n\t\t\tuseWindowing: true,\n\t\t\twindowOverscan: 40,\n\t\t}\n\t);\n\n\t// If there are no blocks to show and we're not showing the appender, do not render the list view.\n\tif ( ! clientIdsTree.length && ! showAppender ) {\n\t\treturn null;\n\t}\n\n\tconst describedById =\n\t\tdescription && `block-editor-list-view-description-${ instanceId }`;\n\n\treturn (\n\t\t<AsyncModeProvider value={ true }>\n\t\t\t<ListViewDropIndicatorPreview\n\t\t\t\tdraggedBlockClientId={ firstDraggedBlockClientId }\n\t\t\t\tlistViewRef={ elementRef }\n\t\t\t\tblockDropTarget={ blockDropTarget }\n\t\t\t/>\n\t\t\t{ description && (\n\t\t\t\t<VisuallyHidden id={ describedById }>\n\t\t\t\t\t{ description }\n\t\t\t\t</VisuallyHidden>\n\t\t\t) }\n\t\t\t<TreeGrid\n\t\t\t\tid={ id }\n\t\t\t\tclassName={ classnames( 'block-editor-list-view-tree', {\n\t\t\t\t\t'is-dragging':\n\t\t\t\t\t\tdraggedClientIds?.length > 0 &&\n\t\t\t\t\t\tblockDropTargetIndex !== undefined,\n\t\t\t\t} ) }\n\t\t\t\taria-label={ __( 'Block navigation structure' ) }\n\t\t\t\tref={ treeGridRef }\n\t\t\t\tonCollapseRow={ collapseRow }\n\t\t\t\tonExpandRow={ expandRow }\n\t\t\t\tonFocusRow={ focusRow }\n\t\t\t\tapplicationAriaLabel={ __( 'Block navigation structure' ) }\n\t\t\t\taria-describedby={ describedById }\n\t\t\t\tstyle={ {\n\t\t\t\t\t'--wp-admin--list-view-dragged-items-height':\n\t\t\t\t\t\tdraggedClientIds?.length\n\t\t\t\t\t\t\t? `${\n\t\t\t\t\t\t\t\t\tBLOCK_LIST_ITEM_HEIGHT *\n\t\t\t\t\t\t\t\t\t( draggedClientIds.length - 1 )\n\t\t\t\t\t\t\t }px`\n\t\t\t\t\t\t\t: null,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ListViewContext.Provider value={ contextValue }>\n\t\t\t\t\t<ListViewBranch\n\t\t\t\t\t\tblocks={ clientIdsTree }\n\t\t\t\t\t\tparentId={ rootClientId }\n\t\t\t\t\t\tselectBlock={ selectEditorBlock }\n\t\t\t\t\t\tshowBlockMovers={ showBlockMovers }\n\t\t\t\t\t\tfixedListWindow={ fixedListWindow }\n\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\tshouldShowInnerBlocks={ shouldShowInnerBlocks }\n\t\t\t\t\t\tshowAppender={ showAppender }\n\t\t\t\t\t/>\n\t\t\t\t</ListViewContext.Provider>\n\t\t\t</TreeGrid>\n\t\t</AsyncModeProvider>\n\t);\n}\n\n// This is the private API for the ListView component.\n// It allows access to all props, not just the public ones.\nexport const PrivateListView = forwardRef( ListViewComponent );\n\n// This is the public API for the ListView component.\n// We wrap the PrivateListView component to hide some props from the public API.\nexport default forwardRef( ( props, ref ) => {\n\treturn (\n\t\t<PrivateListView\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\tshowAppender={ false }\n\t\t\trootClientId={ null }\n\t\t\tonSelect={ null }\n\t\t\tadditionalBlockContent={ null }\n\t\t\tblockSettingsMenu={ undefined }\n\t\t/>\n\t);\n} );\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,WAAA,GAAAF,OAAA;AAIA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AASA,IAAAM,KAAA,GAAAN,OAAA;AAKA,IAAAO,OAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,cAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,kBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,wBAAA,GAAAZ,sBAAA,CAAA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AG,CAAC,CAC5B,IAAG,GACJ;IACL;EAAG,GAEH,IAAAyD,MAAA,CAAAC,aAAA,EAACpH,QAAA,CAAAoI,eAAe,CAACC,QAAQ;IAACf,KAAK,EAAGX;EAAc,GAC/C,IAAAQ,MAAA,CAAAC,aAAA,EAACrH,OAAA,CAAAwH,OAAc;IACdhG,MAAM,EAAGmB,aAAe;IACxB4F,QAAQ,EAAGvG,YAAc;IACzBwG,WAAW,EAAGzD,iBAAmB;IACjCrD,eAAe,EAAGA,eAAiB;IACnCqF,eAAe,EAAGA,eAAiB;IACnClE,iBAAiB,EAAGA,iBAAmB;IACvClB,UAAU,EAAGA,UAAY;IACzB0B,qBAAqB,EAAGA,qBAAuB;IAC/CzB,YAAY,EAAGA;EAAc,CAC7B,CACwB,CACjB,CACQ,CAAC;AAEtB;;AAEA;AACA;AACO,MAAM6G,eAAe,GAAG,IAAAC,mBAAU,EAAEnH,iBAAkB,CAAC;;AAE9D;AACA;AAAAD,OAAA,CAAAmH,eAAA,GAAAA,eAAA;AAAA,IAAAE,QAAA,GACe,IAAAD,mBAAU,EAAE,CAAEE,KAAK,EAAEvG,GAAG,KAAM;EAC5C,OACC,IAAA+E,MAAA,CAAAC,aAAA,EAACoB,eAAe;IACfpG,GAAG,EAAGA,GAAK;IAAA,GACNuG,KAAK;IACVhH,YAAY,EAAG,KAAO;IACtBI,YAAY,EAAG,IAAM;IACrBE,QAAQ,EAAG,IAAM;IACjBC,sBAAsB,EAAG,IAAM;IAC/BN,iBAAiB,EAAG6E;EAAW,CAC/B,CAAC;AAEJ,CAAE,CAAC;AAAApF,OAAA,CAAAkG,OAAA,GAAAmB,QAAA"}
@@ -26,6 +26,7 @@ var _useMovingAnimation = _interopRequireDefault(require("../use-moving-animatio
26
26
 
27
27
  const AnimatedTreeGridRow = (0, _web.animated)(_components.__experimentalTreeGridRow);
28
28
  const ListViewLeaf = (0, _element.forwardRef)(({
29
+ isDragged,
29
30
  isSelected,
30
31
  position,
31
32
  level,
@@ -36,8 +37,7 @@ const ListViewLeaf = (0, _element.forwardRef)(({
36
37
  ...props
37
38
  }, ref) => {
38
39
  const animationRef = (0, _useMovingAnimation.default)({
39
- isSelected,
40
- adjustScrolling: false,
40
+ clientId: props['data-block'],
41
41
  enableAnimation: true,
42
42
  triggerAnimationOnChange: path
43
43
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_web","require","_classnames","_interopRequireDefault","_components","_compose","_element","_useMovingAnimation","AnimatedTreeGridRow","animated","TreeGridRow","ListViewLeaf","forwardRef","isSelected","position","level","rowCount","children","className","path","props","ref","animationRef","useMovingAnimation","adjustScrolling","enableAnimation","triggerAnimationOnChange","mergedRef","useMergeRefs","_react","createElement","classnames","positionInSet","setSize","isExpanded","undefined","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/list-view/leaf.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { animated } from '@react-spring/web';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __experimentalTreeGridRow as TreeGridRow } from '@wordpress/components';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useMovingAnimation from '../use-moving-animation';\n\nconst AnimatedTreeGridRow = animated( TreeGridRow );\n\nconst ListViewLeaf = forwardRef(\n\t(\n\t\t{\n\t\t\tisSelected,\n\t\t\tposition,\n\t\t\tlevel,\n\t\t\trowCount,\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tpath,\n\t\t\t...props\n\t\t},\n\t\tref\n\t) => {\n\t\tconst animationRef = useMovingAnimation( {\n\t\t\tisSelected,\n\t\t\tadjustScrolling: false,\n\t\t\tenableAnimation: true,\n\t\t\ttriggerAnimationOnChange: path,\n\t\t} );\n\n\t\tconst mergedRef = useMergeRefs( [ ref, animationRef ] );\n\n\t\treturn (\n\t\t\t<AnimatedTreeGridRow\n\t\t\t\tref={ mergedRef }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-list-view-leaf',\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tlevel={ level }\n\t\t\t\tpositionInSet={ position }\n\t\t\t\tsetSize={ rowCount }\n\t\t\t\tisExpanded={ undefined }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</AnimatedTreeGridRow>\n\t\t);\n\t}\n);\n\nexport default ListViewLeaf;\n"],"mappings":";;;;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,mBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAhBA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;;AAGA,MAAMO,mBAAmB,GAAG,IAAAC,aAAQ,EAAEC,qCAAY,CAAC;AAEnD,MAAMC,YAAY,GAAG,IAAAC,mBAAU,EAC9B,CACC;EACCC,UAAU;EACVC,QAAQ;EACRC,KAAK;EACLC,QAAQ;EACRC,QAAQ;EACRC,SAAS;EACTC,IAAI;EACJ,GAAGC;AACJ,CAAC,EACDC,GAAG,KACC;EACJ,MAAMC,YAAY,GAAG,IAAAC,2BAAkB,EAAE;IACxCV,UAAU;IACVW,eAAe,EAAE,KAAK;IACtBC,eAAe,EAAE,IAAI;IACrBC,wBAAwB,EAAEP;EAC3B,CAAE,CAAC;EAEH,MAAMQ,SAAS,GAAG,IAAAC,qBAAY,EAAE,CAAEP,GAAG,EAAEC,YAAY,CAAG,CAAC;EAEvD,OACC,IAAAO,MAAA,CAAAC,aAAA,EAACtB,mBAAmB;IACnBa,GAAG,EAAGM,SAAW;IACjBT,SAAS,EAAG,IAAAa,mBAAU,EACrB,6BAA6B,EAC7Bb,SACD,CAAG;IACHH,KAAK,EAAGA,KAAO;IACfiB,aAAa,EAAGlB,QAAU;IAC1BmB,OAAO,EAAGjB,QAAU;IACpBkB,UAAU,EAAGC,SAAW;IAAA,GACnBf;EAAK,GAERH,QACkB,CAAC;AAExB,CACD,CAAC;AAAC,IAAAmB,QAAA,GAEazB,YAAY;AAAA0B,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
1
+ {"version":3,"names":["_web","require","_classnames","_interopRequireDefault","_components","_compose","_element","_useMovingAnimation","AnimatedTreeGridRow","animated","TreeGridRow","ListViewLeaf","forwardRef","isDragged","isSelected","position","level","rowCount","children","className","path","props","ref","animationRef","useMovingAnimation","clientId","enableAnimation","triggerAnimationOnChange","mergedRef","useMergeRefs","_react","createElement","classnames","positionInSet","setSize","isExpanded","undefined","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/list-view/leaf.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { animated } from '@react-spring/web';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __experimentalTreeGridRow as TreeGridRow } from '@wordpress/components';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useMovingAnimation from '../use-moving-animation';\n\nconst AnimatedTreeGridRow = animated( TreeGridRow );\n\nconst ListViewLeaf = forwardRef(\n\t(\n\t\t{\n\t\t\tisDragged,\n\t\t\tisSelected,\n\t\t\tposition,\n\t\t\tlevel,\n\t\t\trowCount,\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tpath,\n\t\t\t...props\n\t\t},\n\t\tref\n\t) => {\n\t\tconst animationRef = useMovingAnimation( {\n\t\t\tclientId: props[ 'data-block' ],\n\t\t\tenableAnimation: true,\n\t\t\ttriggerAnimationOnChange: path,\n\t\t} );\n\n\t\tconst mergedRef = useMergeRefs( [ ref, animationRef ] );\n\n\t\treturn (\n\t\t\t<AnimatedTreeGridRow\n\t\t\t\tref={ mergedRef }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-list-view-leaf',\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tlevel={ level }\n\t\t\t\tpositionInSet={ position }\n\t\t\t\tsetSize={ rowCount }\n\t\t\t\tisExpanded={ undefined }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</AnimatedTreeGridRow>\n\t\t);\n\t}\n);\n\nexport default ListViewLeaf;\n"],"mappings":";;;;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,mBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAhBA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;;AAGA,MAAMO,mBAAmB,GAAG,IAAAC,aAAQ,EAAEC,qCAAY,CAAC;AAEnD,MAAMC,YAAY,GAAG,IAAAC,mBAAU,EAC9B,CACC;EACCC,SAAS;EACTC,UAAU;EACVC,QAAQ;EACRC,KAAK;EACLC,QAAQ;EACRC,QAAQ;EACRC,SAAS;EACTC,IAAI;EACJ,GAAGC;AACJ,CAAC,EACDC,GAAG,KACC;EACJ,MAAMC,YAAY,GAAG,IAAAC,2BAAkB,EAAE;IACxCC,QAAQ,EAAEJ,KAAK,CAAE,YAAY,CAAE;IAC/BK,eAAe,EAAE,IAAI;IACrBC,wBAAwB,EAAEP;EAC3B,CAAE,CAAC;EAEH,MAAMQ,SAAS,GAAG,IAAAC,qBAAY,EAAE,CAAEP,GAAG,EAAEC,YAAY,CAAG,CAAC;EAEvD,OACC,IAAAO,MAAA,CAAAC,aAAA,EAACvB,mBAAmB;IACnBc,GAAG,EAAGM,SAAW;IACjBT,SAAS,EAAG,IAAAa,mBAAU,EACrB,6BAA6B,EAC7Bb,SACD,CAAG;IACHH,KAAK,EAAGA,KAAO;IACfiB,aAAa,EAAGlB,QAAU;IAC1BmB,OAAO,EAAGjB,QAAU;IACpBkB,UAAU,EAAGC,SAAW;IAAA,GACnBf;EAAK,GAERH,QACkB,CAAC;AAExB,CACD,CAAC;AAAC,IAAAmB,QAAA,GAEa1B,YAAY;AAAA2B,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = useListViewBlockIndexes;
7
+ var _element = require("@wordpress/element");
8
+ /**
9
+ * WordPress dependencies
10
+ */
11
+
12
+ function useListViewBlockIndexes(blocks) {
13
+ const blockIndexes = (0, _element.useMemo)(() => {
14
+ const indexes = {};
15
+ let currentGlobalIndex = 0;
16
+ const traverseBlocks = blockList => {
17
+ blockList.forEach(block => {
18
+ indexes[block.clientId] = currentGlobalIndex;
19
+ currentGlobalIndex++;
20
+ if (block.innerBlocks.length > 0) {
21
+ traverseBlocks(block.innerBlocks);
22
+ }
23
+ });
24
+ };
25
+ traverseBlocks(blocks);
26
+ return indexes;
27
+ }, [blocks]);
28
+ return blockIndexes;
29
+ }
30
+ //# sourceMappingURL=use-list-view-block-indexes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_element","require","useListViewBlockIndexes","blocks","blockIndexes","useMemo","indexes","currentGlobalIndex","traverseBlocks","blockList","forEach","block","clientId","innerBlocks","length"],"sources":["@wordpress/block-editor/src/components/list-view/use-list-view-block-indexes.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n\nexport default function useListViewBlockIndexes( blocks ) {\n\tconst blockIndexes = useMemo( () => {\n\t\tconst indexes = {};\n\n\t\tlet currentGlobalIndex = 0;\n\n\t\tconst traverseBlocks = ( blockList ) => {\n\t\t\tblockList.forEach( ( block ) => {\n\t\t\t\tindexes[ block.clientId ] = currentGlobalIndex;\n\t\t\t\tcurrentGlobalIndex++;\n\n\t\t\t\tif ( block.innerBlocks.length > 0 ) {\n\t\t\t\t\ttraverseBlocks( block.innerBlocks );\n\t\t\t\t}\n\t\t\t} );\n\t\t};\n\n\t\ttraverseBlocks( blocks );\n\n\t\treturn indexes;\n\t}, [ blocks ] );\n\n\treturn blockIndexes;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGe,SAASC,uBAAuBA,CAAEC,MAAM,EAAG;EACzD,MAAMC,YAAY,GAAG,IAAAC,gBAAO,EAAE,MAAM;IACnC,MAAMC,OAAO,GAAG,CAAC,CAAC;IAElB,IAAIC,kBAAkB,GAAG,CAAC;IAE1B,MAAMC,cAAc,GAAKC,SAAS,IAAM;MACvCA,SAAS,CAACC,OAAO,CAAIC,KAAK,IAAM;QAC/BL,OAAO,CAAEK,KAAK,CAACC,QAAQ,CAAE,GAAGL,kBAAkB;QAC9CA,kBAAkB,EAAE;QAEpB,IAAKI,KAAK,CAACE,WAAW,CAACC,MAAM,GAAG,CAAC,EAAG;UACnCN,cAAc,CAAEG,KAAK,CAACE,WAAY,CAAC;QACpC;MACD,CAAE,CAAC;IACJ,CAAC;IAEDL,cAAc,CAAEL,MAAO,CAAC;IAExB,OAAOG,OAAO;EACf,CAAC,EAAE,CAAEH,MAAM,CAAG,CAAC;EAEf,OAAOC,YAAY;AACpB"}
@@ -244,6 +244,7 @@ function getListViewDropTarget(blocksData, position, rtl = false) {
244
244
  const newBlockIndex = candidateBlockData.isExpanded ? 0 : candidateBlockData.innerBlockCount || 0;
245
245
  return {
246
246
  rootClientId: candidateBlockData.clientId,
247
+ clientId: candidateBlockData.clientId,
247
248
  blockIndex: newBlockIndex,
248
249
  dropPosition: 'inside'
249
250
  };
@@ -303,16 +304,30 @@ function getListViewDropTarget(blocksData, position, rtl = false) {
303
304
  };
304
305
  }
305
306
 
307
+ // Throttle options need to be defined outside of the hook to avoid
308
+ // re-creating the object on every render. This is due to a limitation
309
+ // of the `useThrottle` hook, where the options object is included
310
+ // in the dependency array for memoization.
311
+ const EXPAND_THROTTLE_OPTIONS = {
312
+ leading: false,
313
+ // Don't call the function immediately on the first call.
314
+ trailing: true // Do call the function on the last call.
315
+ };
316
+
306
317
  /**
307
318
  * A react hook for implementing a drop zone in list view.
308
319
  *
309
- * @param {Object} props Named parameters.
310
- * @param {?HTMLElement} [props.dropZoneElement] Optional element to be used as the drop zone.
320
+ * @param {Object} props Named parameters.
321
+ * @param {?HTMLElement} [props.dropZoneElement] Optional element to be used as the drop zone.
322
+ * @param {Object} [props.expandedState] The expanded state of the blocks in the list view.
323
+ * @param {Function} [props.setExpandedState] Function to set the expanded state of a list of block clientIds.
311
324
  *
312
325
  * @return {WPListViewDropZoneTarget} The drop target.
313
326
  */
314
327
  function useListViewDropZone({
315
- dropZoneElement
328
+ dropZoneElement,
329
+ expandedState,
330
+ setExpandedState
316
331
  }) {
317
332
  const {
318
333
  getBlockRootClientId,
@@ -328,6 +343,36 @@ function useListViewDropZone({
328
343
  } = target || {};
329
344
  const onBlockDrop = (0, _useOnBlockDrop.default)(targetRootClientId, targetBlockIndex);
330
345
  const rtl = (0, _i18n.isRTL)();
346
+ const previousRootClientId = (0, _compose.usePrevious)(targetRootClientId);
347
+ const maybeExpandBlock = (0, _element.useCallback)((_expandedState, _target) => {
348
+ // If the user is attempting to drop a block inside a collapsed block,
349
+ // that is, using a nesting gesture flagged by 'inside' dropPosition,
350
+ // expand the block within the list view, if it isn't already.
351
+ const {
352
+ rootClientId
353
+ } = _target || {};
354
+ if (!rootClientId) {
355
+ return;
356
+ }
357
+ if (_target?.dropPosition === 'inside' && !_expandedState[rootClientId]) {
358
+ setExpandedState({
359
+ type: 'expand',
360
+ clientIds: [rootClientId]
361
+ });
362
+ }
363
+ }, [setExpandedState]);
364
+
365
+ // Throttle the maybeExpandBlock function to avoid expanding the block
366
+ // too quickly when the user is dragging over the block. This is to
367
+ // avoid expanding the block when the user is just passing over it.
368
+ const throttledMaybeExpandBlock = (0, _compose.useThrottle)(maybeExpandBlock, 500, EXPAND_THROTTLE_OPTIONS);
369
+ (0, _element.useEffect)(() => {
370
+ if (target?.dropPosition !== 'inside' || previousRootClientId !== target?.rootClientId) {
371
+ throttledMaybeExpandBlock.cancel();
372
+ return;
373
+ }
374
+ throttledMaybeExpandBlock(expandedState, target);
375
+ }, [expandedState, previousRootClientId, target, throttledMaybeExpandBlock]);
331
376
  const draggedBlockClientIds = getDraggedBlockClientIds();
332
377
  const throttled = (0, _compose.useThrottle)((0, _element.useCallback)((event, currentTarget) => {
333
378
  const position = {
@@ -361,7 +406,7 @@ function useListViewDropZone({
361
406
  if (newTarget) {
362
407
  setTarget(newTarget);
363
408
  }
364
- }, [canInsertBlocks, draggedBlockClientIds, getBlockCount, getBlockIndex, getBlockRootClientId, rtl]), 200);
409
+ }, [canInsertBlocks, draggedBlockClientIds, getBlockCount, getBlockIndex, getBlockRootClientId, rtl]), 50);
365
410
  const ref = (0, _compose.__experimentalUseDropZone)({
366
411
  dropZoneElement,
367
412
  onDrop(event) {
@@ -371,6 +416,9 @@ function useListViewDropZone({
371
416
  },
372
417
  onDragLeave() {
373
418
  throttled.cancel();
419
+ // Use `null` value to indicate that the drop target is not valid,
420
+ // but that the drag is still active. This allows for styling rules
421
+ // that are active only when a user drags outside of the list view.
374
422
  setTarget(null);
375
423
  },
376
424
  onDragOver(event) {
@@ -381,7 +429,10 @@ function useListViewDropZone({
381
429
  },
382
430
  onDragEnd() {
383
431
  throttled.cancel();
384
- setTarget(null);
432
+ // Use `undefined` value to indicate that the drag has concluded.
433
+ // This allows styling rules that are active only when a user is
434
+ // dragging to be removed.
435
+ setTarget(undefined);
385
436
  }
386
437
  });
387
438
  return {
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_element","_compose","_i18n","_math","_useOnBlockDrop","_interopRequireDefault","_store","NESTING_LEVEL_INDENTATION","exports","isUpGesture","point","rect","nestingLevel","rtl","blockIndentPosition","right","left","x","getDesiredRelativeParentLevel","distanceBetweenPointAndBlockIndentPosition","desiredParentLevel","Math","round","abs","getCandidateBlockParents","candidateBlockData","blocksData","candidateBlockParents","currentBlockData","push","find","blockData","clientId","rootClientId","getNextNonDraggedBlock","index","nextBlockData","isDraggedBlock","isNestingGesture","isNestingHorizontalGesture","y","bottom","ALLOWED_DROP_EDGES","getListViewDropTarget","position","candidateEdge","candidateDistance","candidateRect","candidateBlockIndex","i","length","element","getBoundingClientRect","distance","edge","getDistanceToNearestEdge","isCursorWithinBlock","isPointContainedByRect","undefined","indexOf","previousBlockData","isDraggingBelow","canInsertDraggedBlocksAsChild","innerBlockCount","isExpanded","newBlockIndex","blockIndex","dropPosition","nextBlock","currentLevel","nextLevel","desiredRelativeLevel","targetParentIndex","max","min","canInsertDraggedBlocksAsSibling","offset","useListViewDropZone","dropZoneElement","getBlockRootClientId","getBlockIndex","getBlockCount","getDraggedBlockClientIds","canInsertBlocks","useSelect","blockEditorStore","target","setTarget","useState","targetRootClientId","targetBlockIndex","onBlockDrop","useOnBlockDrop","isRTL","draggedBlockClientIds","throttled","useThrottle","useCallback","event","currentTarget","clientX","clientY","isBlockDrag","blockElements","Array","from","querySelectorAll","map","blockElement","dataset","block","expanded","classList","contains","parseInt","getAttribute","newTarget","ref","useDropZone","onDrop","onDragLeave","cancel","onDragOver","onDragEnd"],"sources":["@wordpress/block-editor/src/components/list-view/use-list-view-drop-zone.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useState, useCallback } from '@wordpress/element';\nimport {\n\tuseThrottle,\n\t__experimentalUseDropZone as useDropZone,\n} from '@wordpress/compose';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetDistanceToNearestEdge,\n\tisPointContainedByRect,\n} from '../../utils/math';\nimport useOnBlockDrop from '../use-on-block-drop';\nimport { store as blockEditorStore } from '../../store';\n\n/** @typedef {import('../../utils/math').WPPoint} WPPoint */\n\n/**\n * The type of a drag event.\n *\n * @typedef {'default'|'file'|'html'} WPDragEventType\n */\n\n/**\n * An object representing data for blocks in the DOM used by drag and drop.\n *\n * @typedef {Object} WPListViewDropZoneBlock\n * @property {string} clientId The client id for the block.\n * @property {string} rootClientId The root client id for the block.\n * @property {number} blockIndex The block's index.\n * @property {Element} element The DOM element representing the block.\n * @property {number} innerBlockCount The number of inner blocks the block has.\n * @property {boolean} isDraggedBlock Whether the block is currently being dragged.\n * @property {boolean} isExpanded Whether the block is expanded in the UI.\n * @property {boolean} canInsertDraggedBlocksAsSibling Whether the dragged block can be a sibling of this block.\n * @property {boolean} canInsertDraggedBlocksAsChild Whether the dragged block can be a child of this block.\n */\n\n/**\n * An array representing data for blocks in the DOM used by drag and drop.\n *\n * @typedef {WPListViewDropZoneBlock[]} WPListViewDropZoneBlocks\n */\n\n/**\n * An object containing details of a drop target.\n *\n * @typedef {Object} WPListViewDropZoneTarget\n * @property {string} blockIndex The insertion index.\n * @property {string} rootClientId The root client id for the block.\n * @property {string|undefined} clientId The client id for the block.\n * @property {'top'|'bottom'|'inside'} dropPosition The position relative to the block that the user is dropping to.\n * 'inside' refers to nesting as an inner block.\n */\n\n// When the indentation level, the corresponding left margin in `style.scss`\n// must be updated as well to ensure the drop zone is aligned with the indentation.\nexport const NESTING_LEVEL_INDENTATION = 28;\n\n/**\n * Determines whether the user is positioning the dragged block to be\n * moved up to a parent level.\n *\n * Determined based on nesting level indentation of the current block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n * @param {number} nestingLevel The nesting level of the block.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n * @return {boolean} Whether the gesture is an upward gesture.\n */\nfunction isUpGesture( point, rect, nestingLevel = 1, rtl = false ) {\n\t// If the block is nested, and the user is dragging to the bottom\n\t// left of the block (or bottom right in RTL languages), then it is an upward gesture.\n\tconst blockIndentPosition = rtl\n\t\t? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION\n\t\t: rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;\n\treturn rtl ? point.x > blockIndentPosition : point.x < blockIndentPosition;\n}\n\n/**\n * Returns how many nesting levels up the user is attempting to drag to.\n *\n * The relative parent level is calculated based on how far\n * the cursor is from the provided nesting level (e.g. of a candidate block\n * that the user is hovering over). The nesting level is considered \"desired\"\n * because it is not guaranteed that the user will be able to drag to the desired level.\n *\n * The returned integer can be used to access an ascending array\n * of parent blocks, where the first item is the block the user\n * is hovering over, and the last item is the root block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n * @param {number} nestingLevel The nesting level of the block.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n * @return {number} The desired relative parent level.\n */\nfunction getDesiredRelativeParentLevel(\n\tpoint,\n\trect,\n\tnestingLevel = 1,\n\trtl = false\n) {\n\t// In RTL languages, the block indent position is from the right edge of the block.\n\t// In LTR languages, the block indent position is from the left edge of the block.\n\tconst blockIndentPosition = rtl\n\t\t? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION\n\t\t: rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;\n\n\tconst distanceBetweenPointAndBlockIndentPosition = rtl\n\t\t? blockIndentPosition - point.x\n\t\t: point.x - blockIndentPosition;\n\n\tconst desiredParentLevel = Math.round(\n\t\tdistanceBetweenPointAndBlockIndentPosition / NESTING_LEVEL_INDENTATION\n\t);\n\n\treturn Math.abs( desiredParentLevel );\n}\n\n/**\n * Returns an array of the parent blocks of the block the user is dropping to.\n *\n * @param {WPListViewDropZoneBlock} candidateBlockData The block the user is dropping to.\n * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.\n * @return {WPListViewDropZoneBlocks} An array of block parents, including the block the user is dropping to.\n */\nfunction getCandidateBlockParents( candidateBlockData, blocksData ) {\n\tconst candidateBlockParents = [];\n\tlet currentBlockData = candidateBlockData;\n\n\twhile ( currentBlockData ) {\n\t\tcandidateBlockParents.push( { ...currentBlockData } );\n\t\tcurrentBlockData = blocksData.find(\n\t\t\t( blockData ) =>\n\t\t\t\tblockData.clientId === currentBlockData.rootClientId\n\t\t);\n\t}\n\n\treturn candidateBlockParents;\n}\n\n/**\n * Given a list of blocks data and a block index, return the next non-dragged\n * block. This is used to determine the block that the user is dropping to,\n * while ignoring the dragged block.\n *\n * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.\n * @param {number} index The index to begin searching from.\n * @return {WPListViewDropZoneBlock | undefined} The next non-dragged block.\n */\nfunction getNextNonDraggedBlock( blocksData, index ) {\n\tconst nextBlockData = blocksData[ index + 1 ];\n\tif ( nextBlockData && nextBlockData.isDraggedBlock ) {\n\t\treturn getNextNonDraggedBlock( blocksData, index + 1 );\n\t}\n\n\treturn nextBlockData;\n}\n\n/**\n * Determines whether the user positioning the dragged block to nest as an\n * inner block.\n *\n * Determined based on nesting level indentation of the current block, plus\n * the indentation of the next level of nesting. The vertical position of the\n * cursor must also be within the block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n * @param {number} nestingLevel The nesting level of the block.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n */\nfunction isNestingGesture( point, rect, nestingLevel = 1, rtl = false ) {\n\tconst blockIndentPosition = rtl\n\t\t? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION\n\t\t: rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;\n\n\tconst isNestingHorizontalGesture = rtl\n\t\t? point.x < blockIndentPosition - NESTING_LEVEL_INDENTATION\n\t\t: point.x > blockIndentPosition + NESTING_LEVEL_INDENTATION;\n\n\treturn isNestingHorizontalGesture && point.y < rect.bottom;\n}\n\n// Block navigation is always a vertical list, so only allow dropping\n// to the above or below a block.\nconst ALLOWED_DROP_EDGES = [ 'top', 'bottom' ];\n\n/**\n * Given blocks data and the cursor position, compute the drop target.\n *\n * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.\n * @param {WPPoint} position The point representing the cursor position when dragging.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n *\n * @return {WPListViewDropZoneTarget | undefined} An object containing data about the drop target.\n */\nexport function getListViewDropTarget( blocksData, position, rtl = false ) {\n\tlet candidateEdge;\n\tlet candidateBlockData;\n\tlet candidateDistance;\n\tlet candidateRect;\n\tlet candidateBlockIndex;\n\n\tfor ( let i = 0; i < blocksData.length; i++ ) {\n\t\tconst blockData = blocksData[ i ];\n\t\tif ( blockData.isDraggedBlock ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst rect = blockData.element.getBoundingClientRect();\n\t\tconst [ distance, edge ] = getDistanceToNearestEdge(\n\t\t\tposition,\n\t\t\trect,\n\t\t\tALLOWED_DROP_EDGES\n\t\t);\n\n\t\tconst isCursorWithinBlock = isPointContainedByRect( position, rect );\n\t\tif (\n\t\t\tcandidateDistance === undefined ||\n\t\t\tdistance < candidateDistance ||\n\t\t\tisCursorWithinBlock\n\t\t) {\n\t\t\tcandidateDistance = distance;\n\n\t\t\tconst index = blocksData.indexOf( blockData );\n\t\t\tconst previousBlockData = blocksData[ index - 1 ];\n\n\t\t\t// If dragging near the top of a block and the preceding block\n\t\t\t// is at the same level, use the preceding block as the candidate\n\t\t\t// instead, as later it makes determining a nesting drop easier.\n\t\t\tif (\n\t\t\t\tedge === 'top' &&\n\t\t\t\tpreviousBlockData &&\n\t\t\t\tpreviousBlockData.rootClientId === blockData.rootClientId &&\n\t\t\t\t! previousBlockData.isDraggedBlock\n\t\t\t) {\n\t\t\t\tcandidateBlockData = previousBlockData;\n\t\t\t\tcandidateEdge = 'bottom';\n\t\t\t\tcandidateRect =\n\t\t\t\t\tpreviousBlockData.element.getBoundingClientRect();\n\t\t\t\tcandidateBlockIndex = index - 1;\n\t\t\t} else {\n\t\t\t\tcandidateBlockData = blockData;\n\t\t\t\tcandidateEdge = edge;\n\t\t\t\tcandidateRect = rect;\n\t\t\t\tcandidateBlockIndex = index;\n\t\t\t}\n\n\t\t\t// If the mouse position is within the block, break early\n\t\t\t// as the user would intend to drop either before or after\n\t\t\t// this block.\n\t\t\t//\n\t\t\t// This solves an issue where some rows in the list view\n\t\t\t// tree overlap slightly due to sub-pixel rendering.\n\t\t\tif ( isCursorWithinBlock ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( ! candidateBlockData ) {\n\t\treturn;\n\t}\n\n\tconst candidateBlockParents = getCandidateBlockParents(\n\t\tcandidateBlockData,\n\t\tblocksData\n\t);\n\n\tconst isDraggingBelow = candidateEdge === 'bottom';\n\n\t// If the user is dragging towards the bottom of the block check whether\n\t// they might be trying to nest the block as a child.\n\t// If the block already has inner blocks, and is expanded, this should be treated\n\t// as nesting since the next block in the tree will be the first child.\n\t// However, if the block is collapsed, dragging beneath the block should\n\t// still be allowed, as the next visible block in the tree will be a sibling.\n\tif (\n\t\tisDraggingBelow &&\n\t\tcandidateBlockData.canInsertDraggedBlocksAsChild &&\n\t\t( ( candidateBlockData.innerBlockCount > 0 &&\n\t\t\tcandidateBlockData.isExpanded ) ||\n\t\t\tisNestingGesture(\n\t\t\t\tposition,\n\t\t\t\tcandidateRect,\n\t\t\t\tcandidateBlockParents.length,\n\t\t\t\trtl\n\t\t\t) )\n\t) {\n\t\t// If the block is expanded, insert the block as the first child.\n\t\t// Otherwise, for collapsed blocks, insert the block as the last child.\n\t\tconst newBlockIndex = candidateBlockData.isExpanded\n\t\t\t? 0\n\t\t\t: candidateBlockData.innerBlockCount || 0;\n\n\t\treturn {\n\t\t\trootClientId: candidateBlockData.clientId,\n\t\t\tblockIndex: newBlockIndex,\n\t\t\tdropPosition: 'inside',\n\t\t};\n\t}\n\n\t// If the user is dragging towards the bottom of the block check whether\n\t// they might be trying to move the block to be at a parent level.\n\tif (\n\t\tisDraggingBelow &&\n\t\tcandidateBlockData.rootClientId &&\n\t\tisUpGesture(\n\t\t\tposition,\n\t\t\tcandidateRect,\n\t\t\tcandidateBlockParents.length,\n\t\t\trtl\n\t\t)\n\t) {\n\t\tconst nextBlock = getNextNonDraggedBlock(\n\t\t\tblocksData,\n\t\t\tcandidateBlockIndex\n\t\t);\n\t\tconst currentLevel = candidateBlockData.nestingLevel;\n\t\tconst nextLevel = nextBlock ? nextBlock.nestingLevel : 1;\n\n\t\tif ( currentLevel && nextLevel ) {\n\t\t\t// Determine the desired relative level of the block to be dropped.\n\t\t\tconst desiredRelativeLevel = getDesiredRelativeParentLevel(\n\t\t\t\tposition,\n\t\t\t\tcandidateRect,\n\t\t\t\tcandidateBlockParents.length,\n\t\t\t\trtl\n\t\t\t);\n\n\t\t\tconst targetParentIndex = Math.max(\n\t\t\t\tMath.min( desiredRelativeLevel, currentLevel - nextLevel ),\n\t\t\t\t0\n\t\t\t);\n\n\t\t\tif ( candidateBlockParents[ targetParentIndex ] ) {\n\t\t\t\t// Default to the block index of the candidate block.\n\t\t\t\tlet newBlockIndex = candidateBlockData.blockIndex;\n\n\t\t\t\t// If the next block is at the same level, use that as the default\n\t\t\t\t// block index. This ensures that the block is dropped in the correct\n\t\t\t\t// position when dragging to the bottom of a block.\n\t\t\t\tif (\n\t\t\t\t\tcandidateBlockParents[ targetParentIndex ].nestingLevel ===\n\t\t\t\t\tnextBlock?.nestingLevel\n\t\t\t\t) {\n\t\t\t\t\tnewBlockIndex = nextBlock?.blockIndex;\n\t\t\t\t} else {\n\t\t\t\t\t// Otherwise, search from the current block index back\n\t\t\t\t\t// to find the last block index within the same target parent.\n\t\t\t\t\tfor ( let i = candidateBlockIndex; i >= 0; i-- ) {\n\t\t\t\t\t\tconst blockData = blocksData[ i ];\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tblockData.rootClientId ===\n\t\t\t\t\t\t\tcandidateBlockParents[ targetParentIndex ]\n\t\t\t\t\t\t\t\t.rootClientId\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tnewBlockIndex = blockData.blockIndex + 1;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\trootClientId:\n\t\t\t\t\t\tcandidateBlockParents[ targetParentIndex ].rootClientId,\n\t\t\t\t\tclientId: candidateBlockData.clientId,\n\t\t\t\t\tblockIndex: newBlockIndex,\n\t\t\t\t\tdropPosition: candidateEdge,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n\n\t// If dropping as a sibling, but block cannot be inserted in\n\t// this context, return early.\n\tif ( ! candidateBlockData.canInsertDraggedBlocksAsSibling ) {\n\t\treturn;\n\t}\n\n\tconst offset = isDraggingBelow ? 1 : 0;\n\treturn {\n\t\trootClientId: candidateBlockData.rootClientId,\n\t\tclientId: candidateBlockData.clientId,\n\t\tblockIndex: candidateBlockData.blockIndex + offset,\n\t\tdropPosition: candidateEdge,\n\t};\n}\n\n/**\n * A react hook for implementing a drop zone in list view.\n *\n * @param {Object} props Named parameters.\n * @param {?HTMLElement} [props.dropZoneElement] Optional element to be used as the drop zone.\n *\n * @return {WPListViewDropZoneTarget} The drop target.\n */\nexport default function useListViewDropZone( { dropZoneElement } ) {\n\tconst {\n\t\tgetBlockRootClientId,\n\t\tgetBlockIndex,\n\t\tgetBlockCount,\n\t\tgetDraggedBlockClientIds,\n\t\tcanInsertBlocks,\n\t} = useSelect( blockEditorStore );\n\tconst [ target, setTarget ] = useState();\n\tconst { rootClientId: targetRootClientId, blockIndex: targetBlockIndex } =\n\t\ttarget || {};\n\n\tconst onBlockDrop = useOnBlockDrop( targetRootClientId, targetBlockIndex );\n\n\tconst rtl = isRTL();\n\n\tconst draggedBlockClientIds = getDraggedBlockClientIds();\n\tconst throttled = useThrottle(\n\t\tuseCallback(\n\t\t\t( event, currentTarget ) => {\n\t\t\t\tconst position = { x: event.clientX, y: event.clientY };\n\t\t\t\tconst isBlockDrag = !! draggedBlockClientIds?.length;\n\n\t\t\t\tconst blockElements = Array.from(\n\t\t\t\t\tcurrentTarget.querySelectorAll( '[data-block]' )\n\t\t\t\t);\n\n\t\t\t\tconst blocksData = blockElements.map( ( blockElement ) => {\n\t\t\t\t\tconst clientId = blockElement.dataset.block;\n\t\t\t\t\tconst isExpanded = blockElement.dataset.expanded === 'true';\n\t\t\t\t\tconst isDraggedBlock =\n\t\t\t\t\t\tblockElement.classList.contains( 'is-dragging' );\n\n\t\t\t\t\t// Get nesting level from `aria-level` attribute because Firefox does not support `element.ariaLevel`.\n\t\t\t\t\tconst nestingLevel = parseInt(\n\t\t\t\t\t\tblockElement.getAttribute( 'aria-level' ),\n\t\t\t\t\t\t10\n\t\t\t\t\t);\n\t\t\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\tisExpanded,\n\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\t\t\telement: blockElement,\n\t\t\t\t\t\tnestingLevel: nestingLevel || undefined,\n\t\t\t\t\t\tisDraggedBlock: isBlockDrag ? isDraggedBlock : false,\n\t\t\t\t\t\tinnerBlockCount: getBlockCount( clientId ),\n\t\t\t\t\t\tcanInsertDraggedBlocksAsSibling: isBlockDrag\n\t\t\t\t\t\t\t? canInsertBlocks(\n\t\t\t\t\t\t\t\t\tdraggedBlockClientIds,\n\t\t\t\t\t\t\t\t\trootClientId\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: true,\n\t\t\t\t\t\tcanInsertDraggedBlocksAsChild: isBlockDrag\n\t\t\t\t\t\t\t? canInsertBlocks( draggedBlockClientIds, clientId )\n\t\t\t\t\t\t\t: true,\n\t\t\t\t\t};\n\t\t\t\t} );\n\n\t\t\t\tconst newTarget = getListViewDropTarget(\n\t\t\t\t\tblocksData,\n\t\t\t\t\tposition,\n\t\t\t\t\trtl\n\t\t\t\t);\n\n\t\t\t\tif ( newTarget ) {\n\t\t\t\t\tsetTarget( newTarget );\n\t\t\t\t}\n\t\t\t},\n\t\t\t[\n\t\t\t\tcanInsertBlocks,\n\t\t\t\tdraggedBlockClientIds,\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockIndex,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\trtl,\n\t\t\t]\n\t\t),\n\t\t200\n\t);\n\n\tconst ref = useDropZone( {\n\t\tdropZoneElement,\n\t\tonDrop( event ) {\n\t\t\tif ( target ) {\n\t\t\t\tonBlockDrop( event );\n\t\t\t}\n\t\t},\n\t\tonDragLeave() {\n\t\t\tthrottled.cancel();\n\t\t\tsetTarget( null );\n\t\t},\n\t\tonDragOver( event ) {\n\t\t\t// `currentTarget` is only available while the event is being\n\t\t\t// handled, so get it now and pass it to the thottled function.\n\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget\n\t\t\tthrottled( event, event.currentTarget );\n\t\t},\n\t\tonDragEnd() {\n\t\t\tthrottled.cancel();\n\t\t\tsetTarget( null );\n\t\t},\n\t} );\n\n\treturn { ref, target };\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAIA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,KAAA,GAAAJ,OAAA;AAIA,IAAAK,eAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAnBA;AACA;AACA;;AASA;AACA;AACA;;AAQA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACO,MAAMQ,yBAAyB,GAAG,EAAE;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXAC,OAAA,CAAAD,yBAAA,GAAAA,yBAAA;AAYA,SAASE,WAAWA,CAAEC,KAAK,EAAEC,IAAI,EAAEC,YAAY,GAAG,CAAC,EAAEC,GAAG,GAAG,KAAK,EAAG;EAClE;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CAAEG,KAAK,EAAEA,KAAK,CAACC,aAAc,CAAC;IACxC,CAAC;IACDwB,SAASA,CAAA,EAAG;MACX5B,SAAS,CAAC0B,MAAM,CAAC,CAAC;MAClBlC,SAAS,CAAE,IAAK,CAAC;IAClB;EACD,CAAE,CAAC;EAEH,OAAO;IAAE8B,GAAG;IAAE/B;EAAO,CAAC;AACvB"}
1
+ {"version":3,"names":["_data","require","_element","_compose","_i18n","_math","_useOnBlockDrop","_interopRequireDefault","_store","NESTING_LEVEL_INDENTATION","exports","isUpGesture","point","rect","nestingLevel","rtl","blockIndentPosition","right","left","x","getDesiredRelativeParentLevel","distanceBetweenPointAndBlockIndentPosition","desiredParentLevel","Math","round","abs","getCandidateBlockParents","candidateBlockData","blocksData","candidateBlockParents","currentBlockData","push","find","blockData","clientId","rootClientId","getNextNonDraggedBlock","index","nextBlockData","isDraggedBlock","isNestingGesture","isNestingHorizontalGesture","y","bottom","ALLOWED_DROP_EDGES","getListViewDropTarget","position","candidateEdge","candidateDistance","candidateRect","candidateBlockIndex","i","length","element","getBoundingClientRect","distance","edge","getDistanceToNearestEdge","isCursorWithinBlock","isPointContainedByRect","undefined","indexOf","previousBlockData","isDraggingBelow","canInsertDraggedBlocksAsChild","innerBlockCount","isExpanded","newBlockIndex","blockIndex","dropPosition","nextBlock","currentLevel","nextLevel","desiredRelativeLevel","targetParentIndex","max","min","canInsertDraggedBlocksAsSibling","offset","EXPAND_THROTTLE_OPTIONS","leading","trailing","useListViewDropZone","dropZoneElement","expandedState","setExpandedState","getBlockRootClientId","getBlockIndex","getBlockCount","getDraggedBlockClientIds","canInsertBlocks","useSelect","blockEditorStore","target","setTarget","useState","targetRootClientId","targetBlockIndex","onBlockDrop","useOnBlockDrop","isRTL","previousRootClientId","usePrevious","maybeExpandBlock","useCallback","_expandedState","_target","type","clientIds","throttledMaybeExpandBlock","useThrottle","useEffect","cancel","draggedBlockClientIds","throttled","event","currentTarget","clientX","clientY","isBlockDrag","blockElements","Array","from","querySelectorAll","map","blockElement","dataset","block","expanded","classList","contains","parseInt","getAttribute","newTarget","ref","useDropZone","onDrop","onDragLeave","onDragOver","onDragEnd"],"sources":["@wordpress/block-editor/src/components/list-view/use-list-view-drop-zone.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useState, useCallback, useEffect } from '@wordpress/element';\nimport {\n\tuseThrottle,\n\t__experimentalUseDropZone as useDropZone,\n\tusePrevious,\n} from '@wordpress/compose';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetDistanceToNearestEdge,\n\tisPointContainedByRect,\n} from '../../utils/math';\nimport useOnBlockDrop from '../use-on-block-drop';\nimport { store as blockEditorStore } from '../../store';\n\n/** @typedef {import('../../utils/math').WPPoint} WPPoint */\n\n/**\n * The type of a drag event.\n *\n * @typedef {'default'|'file'|'html'} WPDragEventType\n */\n\n/**\n * An object representing data for blocks in the DOM used by drag and drop.\n *\n * @typedef {Object} WPListViewDropZoneBlock\n * @property {string} clientId The client id for the block.\n * @property {string} rootClientId The root client id for the block.\n * @property {number} blockIndex The block's index.\n * @property {Element} element The DOM element representing the block.\n * @property {number} innerBlockCount The number of inner blocks the block has.\n * @property {boolean} isDraggedBlock Whether the block is currently being dragged.\n * @property {boolean} isExpanded Whether the block is expanded in the UI.\n * @property {boolean} canInsertDraggedBlocksAsSibling Whether the dragged block can be a sibling of this block.\n * @property {boolean} canInsertDraggedBlocksAsChild Whether the dragged block can be a child of this block.\n */\n\n/**\n * An array representing data for blocks in the DOM used by drag and drop.\n *\n * @typedef {WPListViewDropZoneBlock[]} WPListViewDropZoneBlocks\n */\n\n/**\n * An object containing details of a drop target.\n *\n * @typedef {Object} WPListViewDropZoneTarget\n * @property {string} blockIndex The insertion index.\n * @property {string} rootClientId The root client id for the block.\n * @property {string|undefined} clientId The client id for the block.\n * @property {'top'|'bottom'|'inside'} dropPosition The position relative to the block that the user is dropping to.\n * 'inside' refers to nesting as an inner block.\n */\n\n// When the indentation level, the corresponding left margin in `style.scss`\n// must be updated as well to ensure the drop zone is aligned with the indentation.\nexport const NESTING_LEVEL_INDENTATION = 28;\n\n/**\n * Determines whether the user is positioning the dragged block to be\n * moved up to a parent level.\n *\n * Determined based on nesting level indentation of the current block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n * @param {number} nestingLevel The nesting level of the block.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n * @return {boolean} Whether the gesture is an upward gesture.\n */\nfunction isUpGesture( point, rect, nestingLevel = 1, rtl = false ) {\n\t// If the block is nested, and the user is dragging to the bottom\n\t// left of the block (or bottom right in RTL languages), then it is an upward gesture.\n\tconst blockIndentPosition = rtl\n\t\t? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION\n\t\t: rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;\n\treturn rtl ? point.x > blockIndentPosition : point.x < blockIndentPosition;\n}\n\n/**\n * Returns how many nesting levels up the user is attempting to drag to.\n *\n * The relative parent level is calculated based on how far\n * the cursor is from the provided nesting level (e.g. of a candidate block\n * that the user is hovering over). The nesting level is considered \"desired\"\n * because it is not guaranteed that the user will be able to drag to the desired level.\n *\n * The returned integer can be used to access an ascending array\n * of parent blocks, where the first item is the block the user\n * is hovering over, and the last item is the root block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n * @param {number} nestingLevel The nesting level of the block.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n * @return {number} The desired relative parent level.\n */\nfunction getDesiredRelativeParentLevel(\n\tpoint,\n\trect,\n\tnestingLevel = 1,\n\trtl = false\n) {\n\t// In RTL languages, the block indent position is from the right edge of the block.\n\t// In LTR languages, the block indent position is from the left edge of the block.\n\tconst blockIndentPosition = rtl\n\t\t? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION\n\t\t: rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;\n\n\tconst distanceBetweenPointAndBlockIndentPosition = rtl\n\t\t? blockIndentPosition - point.x\n\t\t: point.x - blockIndentPosition;\n\n\tconst desiredParentLevel = Math.round(\n\t\tdistanceBetweenPointAndBlockIndentPosition / NESTING_LEVEL_INDENTATION\n\t);\n\n\treturn Math.abs( desiredParentLevel );\n}\n\n/**\n * Returns an array of the parent blocks of the block the user is dropping to.\n *\n * @param {WPListViewDropZoneBlock} candidateBlockData The block the user is dropping to.\n * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.\n * @return {WPListViewDropZoneBlocks} An array of block parents, including the block the user is dropping to.\n */\nfunction getCandidateBlockParents( candidateBlockData, blocksData ) {\n\tconst candidateBlockParents = [];\n\tlet currentBlockData = candidateBlockData;\n\n\twhile ( currentBlockData ) {\n\t\tcandidateBlockParents.push( { ...currentBlockData } );\n\t\tcurrentBlockData = blocksData.find(\n\t\t\t( blockData ) =>\n\t\t\t\tblockData.clientId === currentBlockData.rootClientId\n\t\t);\n\t}\n\n\treturn candidateBlockParents;\n}\n\n/**\n * Given a list of blocks data and a block index, return the next non-dragged\n * block. This is used to determine the block that the user is dropping to,\n * while ignoring the dragged block.\n *\n * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.\n * @param {number} index The index to begin searching from.\n * @return {WPListViewDropZoneBlock | undefined} The next non-dragged block.\n */\nfunction getNextNonDraggedBlock( blocksData, index ) {\n\tconst nextBlockData = blocksData[ index + 1 ];\n\tif ( nextBlockData && nextBlockData.isDraggedBlock ) {\n\t\treturn getNextNonDraggedBlock( blocksData, index + 1 );\n\t}\n\n\treturn nextBlockData;\n}\n\n/**\n * Determines whether the user positioning the dragged block to nest as an\n * inner block.\n *\n * Determined based on nesting level indentation of the current block, plus\n * the indentation of the next level of nesting. The vertical position of the\n * cursor must also be within the block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n * @param {number} nestingLevel The nesting level of the block.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n */\nfunction isNestingGesture( point, rect, nestingLevel = 1, rtl = false ) {\n\tconst blockIndentPosition = rtl\n\t\t? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION\n\t\t: rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;\n\n\tconst isNestingHorizontalGesture = rtl\n\t\t? point.x < blockIndentPosition - NESTING_LEVEL_INDENTATION\n\t\t: point.x > blockIndentPosition + NESTING_LEVEL_INDENTATION;\n\n\treturn isNestingHorizontalGesture && point.y < rect.bottom;\n}\n\n// Block navigation is always a vertical list, so only allow dropping\n// to the above or below a block.\nconst ALLOWED_DROP_EDGES = [ 'top', 'bottom' ];\n\n/**\n * Given blocks data and the cursor position, compute the drop target.\n *\n * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.\n * @param {WPPoint} position The point representing the cursor position when dragging.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n *\n * @return {WPListViewDropZoneTarget | undefined} An object containing data about the drop target.\n */\nexport function getListViewDropTarget( blocksData, position, rtl = false ) {\n\tlet candidateEdge;\n\tlet candidateBlockData;\n\tlet candidateDistance;\n\tlet candidateRect;\n\tlet candidateBlockIndex;\n\n\tfor ( let i = 0; i < blocksData.length; i++ ) {\n\t\tconst blockData = blocksData[ i ];\n\t\tif ( blockData.isDraggedBlock ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst rect = blockData.element.getBoundingClientRect();\n\t\tconst [ distance, edge ] = getDistanceToNearestEdge(\n\t\t\tposition,\n\t\t\trect,\n\t\t\tALLOWED_DROP_EDGES\n\t\t);\n\n\t\tconst isCursorWithinBlock = isPointContainedByRect( position, rect );\n\t\tif (\n\t\t\tcandidateDistance === undefined ||\n\t\t\tdistance < candidateDistance ||\n\t\t\tisCursorWithinBlock\n\t\t) {\n\t\t\tcandidateDistance = distance;\n\n\t\t\tconst index = blocksData.indexOf( blockData );\n\t\t\tconst previousBlockData = blocksData[ index - 1 ];\n\n\t\t\t// If dragging near the top of a block and the preceding block\n\t\t\t// is at the same level, use the preceding block as the candidate\n\t\t\t// instead, as later it makes determining a nesting drop easier.\n\t\t\tif (\n\t\t\t\tedge === 'top' &&\n\t\t\t\tpreviousBlockData &&\n\t\t\t\tpreviousBlockData.rootClientId === blockData.rootClientId &&\n\t\t\t\t! previousBlockData.isDraggedBlock\n\t\t\t) {\n\t\t\t\tcandidateBlockData = previousBlockData;\n\t\t\t\tcandidateEdge = 'bottom';\n\t\t\t\tcandidateRect =\n\t\t\t\t\tpreviousBlockData.element.getBoundingClientRect();\n\t\t\t\tcandidateBlockIndex = index - 1;\n\t\t\t} else {\n\t\t\t\tcandidateBlockData = blockData;\n\t\t\t\tcandidateEdge = edge;\n\t\t\t\tcandidateRect = rect;\n\t\t\t\tcandidateBlockIndex = index;\n\t\t\t}\n\n\t\t\t// If the mouse position is within the block, break early\n\t\t\t// as the user would intend to drop either before or after\n\t\t\t// this block.\n\t\t\t//\n\t\t\t// This solves an issue where some rows in the list view\n\t\t\t// tree overlap slightly due to sub-pixel rendering.\n\t\t\tif ( isCursorWithinBlock ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( ! candidateBlockData ) {\n\t\treturn;\n\t}\n\n\tconst candidateBlockParents = getCandidateBlockParents(\n\t\tcandidateBlockData,\n\t\tblocksData\n\t);\n\n\tconst isDraggingBelow = candidateEdge === 'bottom';\n\n\t// If the user is dragging towards the bottom of the block check whether\n\t// they might be trying to nest the block as a child.\n\t// If the block already has inner blocks, and is expanded, this should be treated\n\t// as nesting since the next block in the tree will be the first child.\n\t// However, if the block is collapsed, dragging beneath the block should\n\t// still be allowed, as the next visible block in the tree will be a sibling.\n\tif (\n\t\tisDraggingBelow &&\n\t\tcandidateBlockData.canInsertDraggedBlocksAsChild &&\n\t\t( ( candidateBlockData.innerBlockCount > 0 &&\n\t\t\tcandidateBlockData.isExpanded ) ||\n\t\t\tisNestingGesture(\n\t\t\t\tposition,\n\t\t\t\tcandidateRect,\n\t\t\t\tcandidateBlockParents.length,\n\t\t\t\trtl\n\t\t\t) )\n\t) {\n\t\t// If the block is expanded, insert the block as the first child.\n\t\t// Otherwise, for collapsed blocks, insert the block as the last child.\n\t\tconst newBlockIndex = candidateBlockData.isExpanded\n\t\t\t? 0\n\t\t\t: candidateBlockData.innerBlockCount || 0;\n\n\t\treturn {\n\t\t\trootClientId: candidateBlockData.clientId,\n\t\t\tclientId: candidateBlockData.clientId,\n\t\t\tblockIndex: newBlockIndex,\n\t\t\tdropPosition: 'inside',\n\t\t};\n\t}\n\n\t// If the user is dragging towards the bottom of the block check whether\n\t// they might be trying to move the block to be at a parent level.\n\tif (\n\t\tisDraggingBelow &&\n\t\tcandidateBlockData.rootClientId &&\n\t\tisUpGesture(\n\t\t\tposition,\n\t\t\tcandidateRect,\n\t\t\tcandidateBlockParents.length,\n\t\t\trtl\n\t\t)\n\t) {\n\t\tconst nextBlock = getNextNonDraggedBlock(\n\t\t\tblocksData,\n\t\t\tcandidateBlockIndex\n\t\t);\n\t\tconst currentLevel = candidateBlockData.nestingLevel;\n\t\tconst nextLevel = nextBlock ? nextBlock.nestingLevel : 1;\n\n\t\tif ( currentLevel && nextLevel ) {\n\t\t\t// Determine the desired relative level of the block to be dropped.\n\t\t\tconst desiredRelativeLevel = getDesiredRelativeParentLevel(\n\t\t\t\tposition,\n\t\t\t\tcandidateRect,\n\t\t\t\tcandidateBlockParents.length,\n\t\t\t\trtl\n\t\t\t);\n\n\t\t\tconst targetParentIndex = Math.max(\n\t\t\t\tMath.min( desiredRelativeLevel, currentLevel - nextLevel ),\n\t\t\t\t0\n\t\t\t);\n\n\t\t\tif ( candidateBlockParents[ targetParentIndex ] ) {\n\t\t\t\t// Default to the block index of the candidate block.\n\t\t\t\tlet newBlockIndex = candidateBlockData.blockIndex;\n\n\t\t\t\t// If the next block is at the same level, use that as the default\n\t\t\t\t// block index. This ensures that the block is dropped in the correct\n\t\t\t\t// position when dragging to the bottom of a block.\n\t\t\t\tif (\n\t\t\t\t\tcandidateBlockParents[ targetParentIndex ].nestingLevel ===\n\t\t\t\t\tnextBlock?.nestingLevel\n\t\t\t\t) {\n\t\t\t\t\tnewBlockIndex = nextBlock?.blockIndex;\n\t\t\t\t} else {\n\t\t\t\t\t// Otherwise, search from the current block index back\n\t\t\t\t\t// to find the last block index within the same target parent.\n\t\t\t\t\tfor ( let i = candidateBlockIndex; i >= 0; i-- ) {\n\t\t\t\t\t\tconst blockData = blocksData[ i ];\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tblockData.rootClientId ===\n\t\t\t\t\t\t\tcandidateBlockParents[ targetParentIndex ]\n\t\t\t\t\t\t\t\t.rootClientId\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tnewBlockIndex = blockData.blockIndex + 1;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\trootClientId:\n\t\t\t\t\t\tcandidateBlockParents[ targetParentIndex ].rootClientId,\n\t\t\t\t\tclientId: candidateBlockData.clientId,\n\t\t\t\t\tblockIndex: newBlockIndex,\n\t\t\t\t\tdropPosition: candidateEdge,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n\n\t// If dropping as a sibling, but block cannot be inserted in\n\t// this context, return early.\n\tif ( ! candidateBlockData.canInsertDraggedBlocksAsSibling ) {\n\t\treturn;\n\t}\n\n\tconst offset = isDraggingBelow ? 1 : 0;\n\treturn {\n\t\trootClientId: candidateBlockData.rootClientId,\n\t\tclientId: candidateBlockData.clientId,\n\t\tblockIndex: candidateBlockData.blockIndex + offset,\n\t\tdropPosition: candidateEdge,\n\t};\n}\n\n// Throttle options need to be defined outside of the hook to avoid\n// re-creating the object on every render. This is due to a limitation\n// of the `useThrottle` hook, where the options object is included\n// in the dependency array for memoization.\nconst EXPAND_THROTTLE_OPTIONS = {\n\tleading: false, // Don't call the function immediately on the first call.\n\ttrailing: true, // Do call the function on the last call.\n};\n\n/**\n * A react hook for implementing a drop zone in list view.\n *\n * @param {Object} props Named parameters.\n * @param {?HTMLElement} [props.dropZoneElement] Optional element to be used as the drop zone.\n * @param {Object} [props.expandedState] The expanded state of the blocks in the list view.\n * @param {Function} [props.setExpandedState] Function to set the expanded state of a list of block clientIds.\n *\n * @return {WPListViewDropZoneTarget} The drop target.\n */\nexport default function useListViewDropZone( {\n\tdropZoneElement,\n\texpandedState,\n\tsetExpandedState,\n} ) {\n\tconst {\n\t\tgetBlockRootClientId,\n\t\tgetBlockIndex,\n\t\tgetBlockCount,\n\t\tgetDraggedBlockClientIds,\n\t\tcanInsertBlocks,\n\t} = useSelect( blockEditorStore );\n\tconst [ target, setTarget ] = useState();\n\tconst { rootClientId: targetRootClientId, blockIndex: targetBlockIndex } =\n\t\ttarget || {};\n\n\tconst onBlockDrop = useOnBlockDrop( targetRootClientId, targetBlockIndex );\n\n\tconst rtl = isRTL();\n\n\tconst previousRootClientId = usePrevious( targetRootClientId );\n\n\tconst maybeExpandBlock = useCallback(\n\t\t( _expandedState, _target ) => {\n\t\t\t// If the user is attempting to drop a block inside a collapsed block,\n\t\t\t// that is, using a nesting gesture flagged by 'inside' dropPosition,\n\t\t\t// expand the block within the list view, if it isn't already.\n\t\t\tconst { rootClientId } = _target || {};\n\t\t\tif ( ! rootClientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (\n\t\t\t\t_target?.dropPosition === 'inside' &&\n\t\t\t\t! _expandedState[ rootClientId ]\n\t\t\t) {\n\t\t\t\tsetExpandedState( {\n\t\t\t\t\ttype: 'expand',\n\t\t\t\t\tclientIds: [ rootClientId ],\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ setExpandedState ]\n\t);\n\n\t// Throttle the maybeExpandBlock function to avoid expanding the block\n\t// too quickly when the user is dragging over the block. This is to\n\t// avoid expanding the block when the user is just passing over it.\n\tconst throttledMaybeExpandBlock = useThrottle(\n\t\tmaybeExpandBlock,\n\t\t500,\n\t\tEXPAND_THROTTLE_OPTIONS\n\t);\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\ttarget?.dropPosition !== 'inside' ||\n\t\t\tpreviousRootClientId !== target?.rootClientId\n\t\t) {\n\t\t\tthrottledMaybeExpandBlock.cancel();\n\t\t\treturn;\n\t\t}\n\t\tthrottledMaybeExpandBlock( expandedState, target );\n\t}, [\n\t\texpandedState,\n\t\tpreviousRootClientId,\n\t\ttarget,\n\t\tthrottledMaybeExpandBlock,\n\t] );\n\n\tconst draggedBlockClientIds = getDraggedBlockClientIds();\n\tconst throttled = useThrottle(\n\t\tuseCallback(\n\t\t\t( event, currentTarget ) => {\n\t\t\t\tconst position = { x: event.clientX, y: event.clientY };\n\t\t\t\tconst isBlockDrag = !! draggedBlockClientIds?.length;\n\n\t\t\t\tconst blockElements = Array.from(\n\t\t\t\t\tcurrentTarget.querySelectorAll( '[data-block]' )\n\t\t\t\t);\n\n\t\t\t\tconst blocksData = blockElements.map( ( blockElement ) => {\n\t\t\t\t\tconst clientId = blockElement.dataset.block;\n\t\t\t\t\tconst isExpanded = blockElement.dataset.expanded === 'true';\n\t\t\t\t\tconst isDraggedBlock =\n\t\t\t\t\t\tblockElement.classList.contains( 'is-dragging' );\n\n\t\t\t\t\t// Get nesting level from `aria-level` attribute because Firefox does not support `element.ariaLevel`.\n\t\t\t\t\tconst nestingLevel = parseInt(\n\t\t\t\t\t\tblockElement.getAttribute( 'aria-level' ),\n\t\t\t\t\t\t10\n\t\t\t\t\t);\n\t\t\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\tisExpanded,\n\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\t\t\telement: blockElement,\n\t\t\t\t\t\tnestingLevel: nestingLevel || undefined,\n\t\t\t\t\t\tisDraggedBlock: isBlockDrag ? isDraggedBlock : false,\n\t\t\t\t\t\tinnerBlockCount: getBlockCount( clientId ),\n\t\t\t\t\t\tcanInsertDraggedBlocksAsSibling: isBlockDrag\n\t\t\t\t\t\t\t? canInsertBlocks(\n\t\t\t\t\t\t\t\t\tdraggedBlockClientIds,\n\t\t\t\t\t\t\t\t\trootClientId\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: true,\n\t\t\t\t\t\tcanInsertDraggedBlocksAsChild: isBlockDrag\n\t\t\t\t\t\t\t? canInsertBlocks( draggedBlockClientIds, clientId )\n\t\t\t\t\t\t\t: true,\n\t\t\t\t\t};\n\t\t\t\t} );\n\n\t\t\t\tconst newTarget = getListViewDropTarget(\n\t\t\t\t\tblocksData,\n\t\t\t\t\tposition,\n\t\t\t\t\trtl\n\t\t\t\t);\n\n\t\t\t\tif ( newTarget ) {\n\t\t\t\t\tsetTarget( newTarget );\n\t\t\t\t}\n\t\t\t},\n\t\t\t[\n\t\t\t\tcanInsertBlocks,\n\t\t\t\tdraggedBlockClientIds,\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockIndex,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\trtl,\n\t\t\t]\n\t\t),\n\t\t50\n\t);\n\n\tconst ref = useDropZone( {\n\t\tdropZoneElement,\n\t\tonDrop( event ) {\n\t\t\tif ( target ) {\n\t\t\t\tonBlockDrop( event );\n\t\t\t}\n\t\t},\n\t\tonDragLeave() {\n\t\t\tthrottled.cancel();\n\t\t\t// Use `null` value to indicate that the drop target is not valid,\n\t\t\t// but that the drag is still active. This allows for styling rules\n\t\t\t// that are active only when a user drags outside of the list view.\n\t\t\tsetTarget( null );\n\t\t},\n\t\tonDragOver( event ) {\n\t\t\t// `currentTarget` is only available while the event is being\n\t\t\t// handled, so get it now and pass it to the thottled function.\n\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget\n\t\t\tthrottled( event, event.currentTarget );\n\t\t},\n\t\tonDragEnd() {\n\t\t\tthrottled.cancel();\n\t\t\t// Use `undefined` value to indicate that the drag has concluded.\n\t\t\t// This allows styling rules that are active only when a user is\n\t\t\t// dragging to be removed.\n\t\t\tsetTarget( undefined );\n\t\t},\n\t} );\n\n\treturn { ref, target };\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,KAAA,GAAAJ,OAAA;AAIA,IAAAK,eAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AApBA;AACA;AACA;;AAUA;AACA;AACA;;AAQA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACO,MAAMQ,yBAAyB,GAAG,EAAE;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXAC,OAAA,CAAAD,yBAAA,GAAAA,yBAAA;AAYA,SAASE,WAAWA,CAAEC,KAAK,EAAEC,IAAI,EAAEC,YAAY,GAAG,CAAC,EAAEC,GAAG,GAAG,KAAK,EAAG;EAClE;EACA;EACA,MAAMC,mBAAmB,GAAGD,GAAG,GAC5BF,IAAI,CAACI,KAAK,GAAGH,YAAY,GAAGL,yBAAyB,GACrDI,IAAI,CAACK,IAAI,GAAGJ,YAAY,GAAGL,yBAAyB;EACvD,OAAOM,GAAG,GAAGH,KAAK,CAACO,CAAC,GAAGH,mBAAmB,GAAGJ,KAAK,CAACO,CAAC,GAAGH,mBAAmB;AAC3E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASI,6BAA6BA,CACrCR,KAAK,EACLC,IAAI,EACJC,YAAY,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