@wordpress/block-editor 7.0.2 → 8.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (801) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +45 -1
  3. package/build/components/autocomplete/index.js +1 -1
  4. package/build/components/autocomplete/index.js.map +1 -1
  5. package/build/components/block-actions/index.js +8 -4
  6. package/build/components/block-actions/index.js.map +1 -1
  7. package/build/components/block-alignment-control/ui.js +61 -14
  8. package/build/components/block-alignment-control/ui.js.map +1 -1
  9. package/build/components/block-alignment-control/use-available-alignments.js +25 -3
  10. package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
  11. package/build/components/block-controls/fill.js +2 -2
  12. package/build/components/block-controls/fill.js.map +1 -1
  13. package/build/components/block-controls/hook.js +3 -3
  14. package/build/components/block-controls/hook.js.map +1 -1
  15. package/build/components/block-icon/index.js +5 -1
  16. package/build/components/block-icon/index.js.map +1 -1
  17. package/build/components/block-icon/index.native.js +9 -11
  18. package/build/components/block-icon/index.native.js.map +1 -1
  19. package/build/components/block-inspector/index.js +8 -0
  20. package/build/components/block-inspector/index.js.map +1 -1
  21. package/build/components/block-list/block-html.js +5 -0
  22. package/build/components/block-list/block-html.js.map +1 -1
  23. package/build/components/block-list/block.js +12 -5
  24. package/build/components/block-list/block.js.map +1 -1
  25. package/build/components/block-list/block.native.js +4 -3
  26. package/build/components/block-list/block.native.js.map +1 -1
  27. package/build/components/block-list/index.native.js +1 -1
  28. package/build/components/block-list/index.native.js.map +1 -1
  29. package/build/components/block-list/use-block-props/use-multi-selection.js +21 -8
  30. package/build/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
  31. package/build/components/block-list-appender/index.js +9 -1
  32. package/build/components/block-list-appender/index.js.map +1 -1
  33. package/build/components/block-mover/index.js +4 -4
  34. package/build/components/block-mover/index.js.map +1 -1
  35. package/build/components/block-mover/index.native.js +4 -4
  36. package/build/components/block-mover/index.native.js.map +1 -1
  37. package/build/components/block-navigation/dropdown.js +0 -1
  38. package/build/components/block-navigation/dropdown.js.map +1 -1
  39. package/build/components/block-patterns-list/index.js +1 -8
  40. package/build/components/block-patterns-list/index.js.map +1 -1
  41. package/build/components/block-preview/auto.js +1 -1
  42. package/build/components/block-preview/auto.js.map +1 -1
  43. package/build/components/block-settings/container.native.js +5 -2
  44. package/build/components/block-settings/container.native.js.map +1 -1
  45. package/build/components/block-settings-menu/block-settings-dropdown.js +26 -5
  46. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  47. package/build/components/block-settings-menu-controls/index.js +10 -3
  48. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  49. package/build/components/block-styles/preview.native.js +2 -2
  50. package/build/components/block-styles/preview.native.js.map +1 -1
  51. package/build/components/block-switcher/block-styles-menu.js +1 -1
  52. package/build/components/block-switcher/block-styles-menu.js.map +1 -1
  53. package/build/components/block-switcher/index.js +10 -3
  54. package/build/components/block-switcher/index.js.map +1 -1
  55. package/build/components/block-title/index.js +3 -2
  56. package/build/components/block-title/index.js.map +1 -1
  57. package/build/components/block-tools/block-popover.js +2 -4
  58. package/build/components/block-tools/block-popover.js.map +1 -1
  59. package/build/components/block-tools/index.js +4 -1
  60. package/build/components/block-tools/index.js.map +1 -1
  61. package/build/components/block-tools/insertion-point.js +96 -7
  62. package/build/components/block-tools/insertion-point.js.map +1 -1
  63. package/build/components/border-radius-control/index.js.map +1 -1
  64. package/build/components/border-radius-control/utils.js +17 -8
  65. package/build/components/border-radius-control/utils.js.map +1 -1
  66. package/build/components/colors/utils.js +11 -3
  67. package/build/components/colors/utils.js.map +1 -1
  68. package/build/components/colors-gradients/control.js +22 -57
  69. package/build/components/colors-gradients/control.js.map +1 -1
  70. package/build/components/colors-gradients/panel-color-gradient-settings.js +83 -7
  71. package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  72. package/build/components/contrast-checker/index.js +18 -12
  73. package/build/components/contrast-checker/index.js.map +1 -1
  74. package/build/components/copy-handler/index.js +9 -3
  75. package/build/components/copy-handler/index.js.map +1 -1
  76. package/build/components/default-block-appender/index.js +2 -2
  77. package/build/components/default-block-appender/index.js.map +1 -1
  78. package/build/components/duotone-control/index.js +41 -39
  79. package/build/components/duotone-control/index.js.map +1 -1
  80. package/build/components/editor-styles/index.js +9 -3
  81. package/build/components/editor-styles/index.js.map +1 -1
  82. package/build/components/font-appearance-control/index.js +32 -21
  83. package/build/components/font-appearance-control/index.js.map +1 -1
  84. package/build/components/iframe/index.js +6 -4
  85. package/build/components/iframe/index.js.map +1 -1
  86. package/build/components/image-editor/aspect-ratio-dropdown.js +126 -0
  87. package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -0
  88. package/build/components/image-editor/constants.js +16 -0
  89. package/build/components/image-editor/constants.js.map +1 -0
  90. package/build/components/image-editor/context.js +59 -0
  91. package/build/components/image-editor/context.js.map +1 -0
  92. package/build/components/image-editor/cropper.js +83 -0
  93. package/build/components/image-editor/cropper.js.map +1 -0
  94. package/build/components/image-editor/form-controls.js +36 -0
  95. package/build/components/image-editor/form-controls.js.map +1 -0
  96. package/build/components/image-editor/index.js +60 -0
  97. package/build/components/image-editor/index.js.map +1 -0
  98. package/build/components/image-editor/rotation-button.js +37 -0
  99. package/build/components/image-editor/rotation-button.js.map +1 -0
  100. package/build/components/image-editor/use-save-image.js +84 -0
  101. package/build/components/image-editor/use-save-image.js.map +1 -0
  102. package/build/components/image-editor/use-transform-image.js +135 -0
  103. package/build/components/image-editor/use-transform-image.js.map +1 -0
  104. package/build/components/image-editor/zoom-dropdown.js +55 -0
  105. package/build/components/image-editor/zoom-dropdown.js.map +1 -0
  106. package/build/components/image-size-control/use-dimension-handler.js +14 -3
  107. package/build/components/image-size-control/use-dimension-handler.js.map +1 -1
  108. package/build/components/index.js +36 -20
  109. package/build/components/index.js.map +1 -1
  110. package/build/components/index.native.js +2 -2
  111. package/build/components/index.native.js.map +1 -1
  112. package/build/components/inner-blocks/button-block-appender.js +11 -1
  113. package/build/components/inner-blocks/button-block-appender.js.map +1 -1
  114. package/build/components/inner-blocks/index.js +8 -5
  115. package/build/components/inner-blocks/index.js.map +1 -1
  116. package/build/components/inner-blocks/index.native.js +4 -3
  117. package/build/components/inner-blocks/index.native.js.map +1 -1
  118. package/build/components/inner-blocks/use-nested-settings-update.js +24 -13
  119. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  120. package/build/components/inserter/block-patterns-explorer/explorer.js +62 -0
  121. package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -0
  122. package/build/components/inserter/block-patterns-explorer/patterns-list.js +111 -0
  123. package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -0
  124. package/build/components/inserter/block-patterns-explorer/sidebar.js +78 -0
  125. package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -0
  126. package/build/components/inserter/block-patterns-tab.js +74 -35
  127. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  128. package/build/components/inserter/block-types-tab.native.js +3 -11
  129. package/build/components/inserter/block-types-tab.native.js.map +1 -1
  130. package/build/components/inserter/hooks/use-block-type-impressions.native.js +4 -7
  131. package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
  132. package/build/components/inserter/hooks/use-clipboard-block.native.js +5 -4
  133. package/build/components/inserter/hooks/use-clipboard-block.native.js.map +1 -1
  134. package/build/components/inserter/index.js +12 -4
  135. package/build/components/inserter/index.js.map +1 -1
  136. package/build/components/inserter/index.native.js +1 -7
  137. package/build/components/inserter/index.native.js.map +1 -1
  138. package/build/components/inserter/library.js +2 -0
  139. package/build/components/inserter/library.js.map +1 -1
  140. package/build/components/inserter/menu.js +2 -1
  141. package/build/components/inserter/menu.js.map +1 -1
  142. package/build/components/inserter/menu.native.js +11 -15
  143. package/build/components/inserter/menu.native.js.map +1 -1
  144. package/build/components/inserter/pattern-panel.js +19 -10
  145. package/build/components/inserter/pattern-panel.js.map +1 -1
  146. package/build/components/inserter/preview-panel.js +1 -1
  147. package/build/components/inserter/preview-panel.js.map +1 -1
  148. package/build/components/inserter/quick-inserter.js +2 -1
  149. package/build/components/inserter/quick-inserter.js.map +1 -1
  150. package/build/components/inserter/reusable-blocks-tab.native.js +5 -6
  151. package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  152. package/build/components/inserter/search-results.native.js +6 -11
  153. package/build/components/inserter/search-results.native.js.map +1 -1
  154. package/build/components/inserter/utils.native.js +44 -0
  155. package/build/components/inserter/utils.native.js.map +1 -0
  156. package/build/components/inspector-controls/block-support-slot-container.js +28 -0
  157. package/build/components/inspector-controls/block-support-slot-container.js.map +1 -0
  158. package/build/components/inspector-controls/block-support-tools-panel.js +78 -0
  159. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -0
  160. package/build/components/inspector-controls/fill.js +16 -1
  161. package/build/components/inspector-controls/fill.js.map +1 -1
  162. package/build/components/inspector-controls/groups.js +5 -1
  163. package/build/components/inspector-controls/groups.js.map +1 -1
  164. package/build/components/inspector-controls/slot.js +15 -0
  165. package/build/components/inspector-controls/slot.js.map +1 -1
  166. package/build/components/letter-spacing-control/index.js +9 -6
  167. package/build/components/letter-spacing-control/index.js.map +1 -1
  168. package/build/components/link-control/index.js +93 -34
  169. package/build/components/link-control/index.js.map +1 -1
  170. package/build/components/link-control/link-preview.js +45 -15
  171. package/build/components/link-control/link-preview.js.map +1 -1
  172. package/build/components/link-control/search-input.js +25 -7
  173. package/build/components/link-control/search-input.js.map +1 -1
  174. package/build/components/list-view/block-contents.js +1 -20
  175. package/build/components/list-view/block-contents.js.map +1 -1
  176. package/build/components/list-view/block.js +54 -69
  177. package/build/components/list-view/block.js.map +1 -1
  178. package/build/components/list-view/branch.js +102 -76
  179. package/build/components/list-view/branch.js.map +1 -1
  180. package/build/components/list-view/index.js +45 -20
  181. package/build/components/list-view/index.js.map +1 -1
  182. package/build/components/list-view/leaf.js +2 -2
  183. package/build/components/list-view/leaf.js.map +1 -1
  184. package/build/components/list-view/list-item.js +3 -2
  185. package/build/components/list-view/list-item.js.map +1 -1
  186. package/build/components/list-view/use-list-view-client-ids.js +13 -54
  187. package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
  188. package/build/components/media-placeholder/index.js +29 -20
  189. package/build/components/media-placeholder/index.js.map +1 -1
  190. package/build/components/media-replace-flow/index.js +5 -3
  191. package/build/components/media-replace-flow/index.js.map +1 -1
  192. package/build/components/navigable-toolbar/index.js +1 -4
  193. package/build/components/navigable-toolbar/index.js.map +1 -1
  194. package/build/components/observe-typing/index.js +1 -1
  195. package/build/components/observe-typing/index.js.map +1 -1
  196. package/build/components/plain-text/index.native.js +30 -1
  197. package/build/components/plain-text/index.native.js.map +1 -1
  198. package/build/components/rich-text/embed-handler-picker.native.js +66 -0
  199. package/build/components/rich-text/embed-handler-picker.native.js.map +1 -0
  200. package/build/components/rich-text/format-edit.js +28 -2
  201. package/build/components/rich-text/format-edit.js.map +1 -1
  202. package/build/components/rich-text/format-toolbar/index.js +32 -11
  203. package/build/components/rich-text/format-toolbar/index.js.map +1 -1
  204. package/build/components/rich-text/index.js +5 -1
  205. package/build/components/rich-text/index.js.map +1 -1
  206. package/build/components/rich-text/index.native.js +41 -2
  207. package/build/components/rich-text/index.native.js.map +1 -1
  208. package/build/components/rich-text/use-paste-handler.js +28 -9
  209. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  210. package/build/components/rich-text/utils.js +22 -0
  211. package/build/components/rich-text/utils.js.map +1 -1
  212. package/build/components/typewriter/index.js +1 -1
  213. package/build/components/typewriter/index.js.map +1 -1
  214. package/build/components/url-input/index.js +25 -11
  215. package/build/components/url-input/index.js.map +1 -1
  216. package/build/components/use-moving-animation/index.js +13 -10
  217. package/build/components/use-moving-animation/index.js.map +1 -1
  218. package/build/components/use-on-block-drop/index.js +2 -1
  219. package/build/components/use-on-block-drop/index.js.map +1 -1
  220. package/build/components/use-setting/index.js +48 -9
  221. package/build/components/use-setting/index.js.map +1 -1
  222. package/build/components/writing-flow/use-multi-selection.js +6 -0
  223. package/build/components/writing-flow/use-multi-selection.js.map +1 -1
  224. package/build/components/writing-flow/use-tab-nav.js +10 -1
  225. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  226. package/build/hooks/align.js +13 -10
  227. package/build/hooks/align.js.map +1 -1
  228. package/build/hooks/anchor.js +1 -1
  229. package/build/hooks/anchor.js.map +1 -1
  230. package/build/hooks/border.js +5 -5
  231. package/build/hooks/border.js.map +1 -1
  232. package/build/hooks/color-panel.js +5 -2
  233. package/build/hooks/color-panel.js.map +1 -1
  234. package/build/hooks/color.js +1 -1
  235. package/build/hooks/color.js.map +1 -1
  236. package/build/hooks/dimensions.js +23 -27
  237. package/build/hooks/dimensions.js.map +1 -1
  238. package/build/hooks/duotone.js +60 -16
  239. package/build/hooks/duotone.js.map +1 -1
  240. package/build/hooks/font-appearance.js +49 -6
  241. package/build/hooks/font-appearance.js.map +1 -1
  242. package/build/hooks/font-family.js +123 -32
  243. package/build/hooks/font-family.js.map +1 -1
  244. package/build/hooks/font-size.js +51 -9
  245. package/build/hooks/font-size.js.map +1 -1
  246. package/build/hooks/gap.js +2 -1
  247. package/build/hooks/gap.js.map +1 -1
  248. package/build/hooks/index.js +10 -0
  249. package/build/hooks/index.js.map +1 -1
  250. package/build/hooks/index.native.js +8 -0
  251. package/build/hooks/index.native.js.map +1 -1
  252. package/build/hooks/letter-spacing.js +44 -7
  253. package/build/hooks/letter-spacing.js.map +1 -1
  254. package/build/hooks/line-height.js +45 -8
  255. package/build/hooks/line-height.js.map +1 -1
  256. package/build/hooks/lock.js +43 -0
  257. package/build/hooks/lock.js.map +1 -0
  258. package/build/hooks/margin.js +1 -1
  259. package/build/hooks/margin.js.map +1 -1
  260. package/build/hooks/padding.js +1 -1
  261. package/build/hooks/padding.js.map +1 -1
  262. package/build/hooks/style.js +7 -4
  263. package/build/hooks/style.js.map +1 -1
  264. package/build/hooks/text-decoration.js +42 -6
  265. package/build/hooks/text-decoration.js.map +1 -1
  266. package/build/hooks/text-transform.js +42 -6
  267. package/build/hooks/text-transform.js.map +1 -1
  268. package/build/hooks/typography.js +108 -8
  269. package/build/hooks/typography.js.map +1 -1
  270. package/build/hooks/use-cached-truthy.js +29 -0
  271. package/build/hooks/use-cached-truthy.js.map +1 -0
  272. package/build/index.js +7 -0
  273. package/build/index.js.map +1 -1
  274. package/build/layouts/flex.js +160 -34
  275. package/build/layouts/flex.js.map +1 -1
  276. package/build/layouts/flow.js +75 -8
  277. package/build/layouts/flow.js.map +1 -1
  278. package/build/store/actions.js +323 -265
  279. package/build/store/actions.js.map +1 -1
  280. package/build/store/defaults.native.js +13 -1
  281. package/build/store/defaults.native.js.map +1 -1
  282. package/build/store/index.js +1 -3
  283. package/build/store/index.js.map +1 -1
  284. package/build/store/reducer.js +33 -22
  285. package/build/store/reducer.js.map +1 -1
  286. package/build/store/selectors.js +172 -38
  287. package/build/store/selectors.js.map +1 -1
  288. package/build/utils/index.js +10 -1
  289. package/build/utils/index.js.map +1 -1
  290. package/build/utils/parse-css-unit-to-px.js +51 -1
  291. package/build/utils/parse-css-unit-to-px.js.map +1 -1
  292. package/build/utils/transform-styles/transforms/wrap.js +16 -0
  293. package/build/utils/transform-styles/transforms/wrap.js.map +1 -1
  294. package/build-module/components/autocomplete/index.js +2 -2
  295. package/build-module/components/autocomplete/index.js.map +1 -1
  296. package/build-module/components/block-actions/index.js +8 -4
  297. package/build-module/components/block-actions/index.js.map +1 -1
  298. package/build-module/components/block-alignment-control/ui.js +64 -17
  299. package/build-module/components/block-alignment-control/ui.js.map +1 -1
  300. package/build-module/components/block-alignment-control/use-available-alignments.js +25 -3
  301. package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
  302. package/build-module/components/block-controls/fill.js +2 -2
  303. package/build-module/components/block-controls/fill.js.map +1 -1
  304. package/build-module/components/block-controls/hook.js +3 -3
  305. package/build-module/components/block-controls/hook.js.map +1 -1
  306. package/build-module/components/block-icon/index.js +5 -1
  307. package/build-module/components/block-icon/index.js.map +1 -1
  308. package/build-module/components/block-icon/index.native.js +10 -11
  309. package/build-module/components/block-icon/index.native.js.map +1 -1
  310. package/build-module/components/block-inspector/index.js +8 -0
  311. package/build-module/components/block-inspector/index.js.map +1 -1
  312. package/build-module/components/block-list/block-html.js +5 -0
  313. package/build-module/components/block-list/block-html.js.map +1 -1
  314. package/build-module/components/block-list/block.js +12 -5
  315. package/build-module/components/block-list/block.js.map +1 -1
  316. package/build-module/components/block-list/block.native.js +4 -3
  317. package/build-module/components/block-list/block.native.js.map +1 -1
  318. package/build-module/components/block-list/index.native.js +1 -1
  319. package/build-module/components/block-list/index.native.js.map +1 -1
  320. package/build-module/components/block-list/use-block-props/use-multi-selection.js +21 -8
  321. package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
  322. package/build-module/components/block-list-appender/index.js +9 -1
  323. package/build-module/components/block-list-appender/index.js.map +1 -1
  324. package/build-module/components/block-mover/index.js +4 -4
  325. package/build-module/components/block-mover/index.js.map +1 -1
  326. package/build-module/components/block-mover/index.native.js +4 -4
  327. package/build-module/components/block-mover/index.native.js.map +1 -1
  328. package/build-module/components/block-navigation/dropdown.js +0 -1
  329. package/build-module/components/block-navigation/dropdown.js.map +1 -1
  330. package/build-module/components/block-patterns-list/index.js +1 -6
  331. package/build-module/components/block-patterns-list/index.js.map +1 -1
  332. package/build-module/components/block-preview/auto.js +1 -1
  333. package/build-module/components/block-preview/auto.js.map +1 -1
  334. package/build-module/components/block-settings/container.native.js +6 -3
  335. package/build-module/components/block-settings/container.native.js.map +1 -1
  336. package/build-module/components/block-settings-menu/block-settings-dropdown.js +28 -7
  337. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  338. package/build-module/components/block-settings-menu-controls/index.js +10 -3
  339. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  340. package/build-module/components/block-styles/preview.native.js +2 -2
  341. package/build-module/components/block-styles/preview.native.js.map +1 -1
  342. package/build-module/components/block-switcher/block-styles-menu.js +1 -1
  343. package/build-module/components/block-switcher/block-styles-menu.js.map +1 -1
  344. package/build-module/components/block-switcher/index.js +10 -3
  345. package/build-module/components/block-switcher/index.js.map +1 -1
  346. package/build-module/components/block-title/index.js +3 -2
  347. package/build-module/components/block-title/index.js.map +1 -1
  348. package/build-module/components/block-tools/block-popover.js +3 -5
  349. package/build-module/components/block-tools/block-popover.js.map +1 -1
  350. package/build-module/components/block-tools/index.js +4 -1
  351. package/build-module/components/block-tools/index.js.map +1 -1
  352. package/build-module/components/block-tools/insertion-point.js +96 -8
  353. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  354. package/build-module/components/border-radius-control/index.js.map +1 -1
  355. package/build-module/components/border-radius-control/utils.js +16 -9
  356. package/build-module/components/border-radius-control/utils.js.map +1 -1
  357. package/build-module/components/colors/utils.js +9 -3
  358. package/build-module/components/colors/utils.js.map +1 -1
  359. package/build-module/components/colors-gradients/control.js +26 -63
  360. package/build-module/components/colors-gradients/control.js.map +1 -1
  361. package/build-module/components/colors-gradients/panel-color-gradient-settings.js +84 -7
  362. package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  363. package/build-module/components/contrast-checker/index.js +13 -10
  364. package/build-module/components/contrast-checker/index.js.map +1 -1
  365. package/build-module/components/copy-handler/index.js +9 -3
  366. package/build-module/components/copy-handler/index.js.map +1 -1
  367. package/build-module/components/default-block-appender/index.js +2 -2
  368. package/build-module/components/default-block-appender/index.js.map +1 -1
  369. package/build-module/components/duotone-control/index.js +43 -39
  370. package/build-module/components/duotone-control/index.js.map +1 -1
  371. package/build-module/components/editor-styles/index.js +7 -3
  372. package/build-module/components/editor-styles/index.js.map +1 -1
  373. package/build-module/components/font-appearance-control/index.js +28 -21
  374. package/build-module/components/font-appearance-control/index.js.map +1 -1
  375. package/build-module/components/iframe/index.js +6 -4
  376. package/build-module/components/iframe/index.js.map +1 -1
  377. package/build-module/components/image-editor/aspect-ratio-dropdown.js +115 -0
  378. package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -0
  379. package/build-module/components/image-editor/constants.js +7 -0
  380. package/build-module/components/image-editor/constants.js.map +1 -0
  381. package/build-module/components/image-editor/context.js +44 -0
  382. package/build-module/components/image-editor/context.js.map +1 -0
  383. package/build-module/components/image-editor/cropper.js +69 -0
  384. package/build-module/components/image-editor/cropper.js.map +1 -0
  385. package/build-module/components/image-editor/form-controls.js +26 -0
  386. package/build-module/components/image-editor/form-controls.js.map +1 -0
  387. package/build-module/components/image-editor/index.js +37 -0
  388. package/build-module/components/image-editor/index.js.map +1 -0
  389. package/build-module/components/image-editor/rotation-button.js +26 -0
  390. package/build-module/components/image-editor/rotation-button.js.map +1 -0
  391. package/build-module/components/image-editor/use-save-image.js +70 -0
  392. package/build-module/components/image-editor/use-save-image.js.map +1 -0
  393. package/build-module/components/image-editor/use-transform-image.js +127 -0
  394. package/build-module/components/image-editor/use-transform-image.js.map +1 -0
  395. package/build-module/components/image-editor/zoom-dropdown.js +43 -0
  396. package/build-module/components/image-editor/zoom-dropdown.js.map +1 -0
  397. package/build-module/components/image-size-control/use-dimension-handler.js +13 -2
  398. package/build-module/components/image-size-control/use-dimension-handler.js.map +1 -1
  399. package/build-module/components/index.js +4 -3
  400. package/build-module/components/index.js.map +1 -1
  401. package/build-module/components/index.native.js +1 -1
  402. package/build-module/components/index.native.js.map +1 -1
  403. package/build-module/components/inner-blocks/button-block-appender.js +10 -1
  404. package/build-module/components/inner-blocks/button-block-appender.js.map +1 -1
  405. package/build-module/components/inner-blocks/index.js +9 -6
  406. package/build-module/components/inner-blocks/index.js.map +1 -1
  407. package/build-module/components/inner-blocks/index.native.js +5 -4
  408. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  409. package/build-module/components/inner-blocks/use-nested-settings-update.js +24 -13
  410. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  411. package/build-module/components/inserter/block-patterns-explorer/explorer.js +50 -0
  412. package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -0
  413. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +92 -0
  414. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -0
  415. package/build-module/components/inserter/block-patterns-explorer/sidebar.js +69 -0
  416. package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -0
  417. package/build-module/components/inserter/block-patterns-tab.js +75 -36
  418. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  419. package/build-module/components/inserter/block-types-tab.native.js +2 -10
  420. package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
  421. package/build-module/components/inserter/hooks/use-block-type-impressions.native.js +4 -7
  422. package/build-module/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
  423. package/build-module/components/inserter/hooks/use-clipboard-block.native.js +5 -4
  424. package/build-module/components/inserter/hooks/use-clipboard-block.native.js.map +1 -1
  425. package/build-module/components/inserter/index.js +12 -4
  426. package/build-module/components/inserter/index.js.map +1 -1
  427. package/build-module/components/inserter/index.native.js +1 -7
  428. package/build-module/components/inserter/index.native.js.map +1 -1
  429. package/build-module/components/inserter/library.js +2 -0
  430. package/build-module/components/inserter/library.js.map +1 -1
  431. package/build-module/components/inserter/menu.js +2 -1
  432. package/build-module/components/inserter/menu.js.map +1 -1
  433. package/build-module/components/inserter/menu.native.js +10 -15
  434. package/build-module/components/inserter/menu.native.js.map +1 -1
  435. package/build-module/components/inserter/pattern-panel.js +21 -13
  436. package/build-module/components/inserter/pattern-panel.js.map +1 -1
  437. package/build-module/components/inserter/preview-panel.js +1 -1
  438. package/build-module/components/inserter/preview-panel.js.map +1 -1
  439. package/build-module/components/inserter/quick-inserter.js +2 -1
  440. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  441. package/build-module/components/inserter/reusable-blocks-tab.native.js +4 -5
  442. package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  443. package/build-module/components/inserter/search-results.native.js +5 -10
  444. package/build-module/components/inserter/search-results.native.js.map +1 -1
  445. package/build-module/components/inserter/utils.native.js +35 -0
  446. package/build-module/components/inserter/utils.native.js.map +1 -0
  447. package/build-module/components/inspector-controls/block-support-slot-container.js +18 -0
  448. package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -0
  449. package/build-module/components/inspector-controls/block-support-tools-panel.js +67 -0
  450. package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -0
  451. package/build-module/components/inspector-controls/fill.js +16 -2
  452. package/build-module/components/inspector-controls/fill.js.map +1 -1
  453. package/build-module/components/inspector-controls/groups.js +5 -1
  454. package/build-module/components/inspector-controls/groups.js.map +1 -1
  455. package/build-module/components/inspector-controls/slot.js +13 -0
  456. package/build-module/components/inspector-controls/slot.js.map +1 -1
  457. package/build-module/components/letter-spacing-control/index.js +9 -6
  458. package/build-module/components/letter-spacing-control/index.js.map +1 -1
  459. package/build-module/components/link-control/index.js +93 -35
  460. package/build-module/components/link-control/index.js.map +1 -1
  461. package/build-module/components/link-control/link-preview.js +46 -17
  462. package/build-module/components/link-control/link-preview.js.map +1 -1
  463. package/build-module/components/link-control/search-input.js +24 -7
  464. package/build-module/components/link-control/search-input.js.map +1 -1
  465. package/build-module/components/list-view/block-contents.js +1 -18
  466. package/build-module/components/list-view/block-contents.js.map +1 -1
  467. package/build-module/components/list-view/block.js +56 -71
  468. package/build-module/components/list-view/block.js.map +1 -1
  469. package/build-module/components/list-view/branch.js +102 -78
  470. package/build-module/components/list-view/branch.js.map +1 -1
  471. package/build-module/components/list-view/index.js +48 -23
  472. package/build-module/components/list-view/index.js.map +1 -1
  473. package/build-module/components/list-view/leaf.js +2 -2
  474. package/build-module/components/list-view/leaf.js.map +1 -1
  475. package/build-module/components/list-view/list-item.js +3 -2
  476. package/build-module/components/list-view/list-item.js.map +1 -1
  477. package/build-module/components/list-view/use-list-view-client-ids.js +13 -54
  478. package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
  479. package/build-module/components/media-placeholder/index.js +29 -20
  480. package/build-module/components/media-placeholder/index.js.map +1 -1
  481. package/build-module/components/media-replace-flow/index.js +5 -3
  482. package/build-module/components/media-replace-flow/index.js.map +1 -1
  483. package/build-module/components/navigable-toolbar/index.js +1 -4
  484. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  485. package/build-module/components/observe-typing/index.js +1 -1
  486. package/build-module/components/observe-typing/index.js.map +1 -1
  487. package/build-module/components/plain-text/index.native.js +29 -2
  488. package/build-module/components/plain-text/index.native.js.map +1 -1
  489. package/build-module/components/rich-text/embed-handler-picker.native.js +54 -0
  490. package/build-module/components/rich-text/embed-handler-picker.native.js.map +1 -0
  491. package/build-module/components/rich-text/format-edit.js +28 -3
  492. package/build-module/components/rich-text/format-edit.js.map +1 -1
  493. package/build-module/components/rich-text/format-toolbar/index.js +29 -11
  494. package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
  495. package/build-module/components/rich-text/index.js +4 -1
  496. package/build-module/components/rich-text/index.js.map +1 -1
  497. package/build-module/components/rich-text/index.native.js +41 -3
  498. package/build-module/components/rich-text/index.native.js.map +1 -1
  499. package/build-module/components/rich-text/use-paste-handler.js +28 -9
  500. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  501. package/build-module/components/rich-text/utils.js +20 -0
  502. package/build-module/components/rich-text/utils.js.map +1 -1
  503. package/build-module/components/typewriter/index.js +1 -1
  504. package/build-module/components/typewriter/index.js.map +1 -1
  505. package/build-module/components/url-input/index.js +25 -11
  506. package/build-module/components/url-input/index.js.map +1 -1
  507. package/build-module/components/use-moving-animation/index.js +13 -10
  508. package/build-module/components/use-moving-animation/index.js.map +1 -1
  509. package/build-module/components/use-on-block-drop/index.js +3 -2
  510. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  511. package/build-module/components/use-setting/index.js +48 -9
  512. package/build-module/components/use-setting/index.js.map +1 -1
  513. package/build-module/components/writing-flow/use-multi-selection.js +6 -0
  514. package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
  515. package/build-module/components/writing-flow/use-tab-nav.js +10 -1
  516. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  517. package/build-module/hooks/align.js +13 -10
  518. package/build-module/hooks/align.js.map +1 -1
  519. package/build-module/hooks/anchor.js +1 -1
  520. package/build-module/hooks/anchor.js.map +1 -1
  521. package/build-module/hooks/border.js +5 -5
  522. package/build-module/hooks/border.js.map +1 -1
  523. package/build-module/hooks/color-panel.js +6 -3
  524. package/build-module/hooks/color-panel.js.map +1 -1
  525. package/build-module/hooks/color.js +1 -1
  526. package/build-module/hooks/color.js.map +1 -1
  527. package/build-module/hooks/dimensions.js +24 -27
  528. package/build-module/hooks/dimensions.js.map +1 -1
  529. package/build-module/hooks/duotone.js +59 -16
  530. package/build-module/hooks/duotone.js.map +1 -1
  531. package/build-module/hooks/font-appearance.js +45 -6
  532. package/build-module/hooks/font-appearance.js.map +1 -1
  533. package/build-module/hooks/font-family.js +117 -33
  534. package/build-module/hooks/font-family.js.map +1 -1
  535. package/build-module/hooks/font-size.js +47 -9
  536. package/build-module/hooks/font-size.js.map +1 -1
  537. package/build-module/hooks/gap.js +2 -1
  538. package/build-module/hooks/gap.js.map +1 -1
  539. package/build-module/hooks/index.js +2 -0
  540. package/build-module/hooks/index.js.map +1 -1
  541. package/build-module/hooks/index.native.js +1 -0
  542. package/build-module/hooks/index.native.js.map +1 -1
  543. package/build-module/hooks/letter-spacing.js +40 -7
  544. package/build-module/hooks/letter-spacing.js.map +1 -1
  545. package/build-module/hooks/line-height.js +41 -8
  546. package/build-module/hooks/line-height.js.map +1 -1
  547. package/build-module/hooks/lock.js +33 -0
  548. package/build-module/hooks/lock.js.map +1 -0
  549. package/build-module/hooks/margin.js +1 -1
  550. package/build-module/hooks/margin.js.map +1 -1
  551. package/build-module/hooks/padding.js +1 -1
  552. package/build-module/hooks/padding.js.map +1 -1
  553. package/build-module/hooks/style.js +7 -4
  554. package/build-module/hooks/style.js.map +1 -1
  555. package/build-module/hooks/text-decoration.js +38 -6
  556. package/build-module/hooks/text-decoration.js.map +1 -1
  557. package/build-module/hooks/text-transform.js +38 -6
  558. package/build-module/hooks/text-transform.js.map +1 -1
  559. package/build-module/hooks/typography.js +117 -17
  560. package/build-module/hooks/typography.js.map +1 -1
  561. package/build-module/hooks/use-cached-truthy.js +21 -0
  562. package/build-module/hooks/use-cached-truthy.js.map +1 -0
  563. package/build-module/index.js +1 -1
  564. package/build-module/index.js.map +1 -1
  565. package/build-module/layouts/flex.js +163 -38
  566. package/build-module/layouts/flex.js.map +1 -1
  567. package/build-module/layouts/flow.js +74 -8
  568. package/build-module/layouts/flow.js.map +1 -1
  569. package/build-module/store/actions.js +286 -241
  570. package/build-module/store/actions.js.map +1 -1
  571. package/build-module/store/defaults.native.js +12 -1
  572. package/build-module/store/defaults.native.js.map +1 -1
  573. package/build-module/store/index.js +1 -2
  574. package/build-module/store/index.js.map +1 -1
  575. package/build-module/store/reducer.js +33 -22
  576. package/build-module/store/reducer.js.map +1 -1
  577. package/build-module/store/selectors.js +160 -34
  578. package/build-module/store/selectors.js.map +1 -1
  579. package/build-module/utils/index.js +1 -0
  580. package/build-module/utils/index.js.map +1 -1
  581. package/build-module/utils/parse-css-unit-to-px.js +48 -1
  582. package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
  583. package/build-module/utils/transform-styles/transforms/wrap.js +16 -0
  584. package/build-module/utils/transform-styles/transforms/wrap.js.map +1 -1
  585. package/build-style/style-rtl.css +267 -144
  586. package/build-style/style.css +267 -144
  587. package/package.json +28 -27
  588. package/src/components/autocomplete/index.js +5 -2
  589. package/src/components/block-actions/index.js +9 -5
  590. package/src/components/block-alignment-control/style.scss +5 -0
  591. package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +15 -1
  592. package/src/components/block-alignment-control/test/index.native.js +37 -0
  593. package/src/components/block-alignment-control/ui.js +98 -27
  594. package/src/components/block-alignment-control/use-available-alignments.js +31 -10
  595. package/src/components/block-controls/fill.js +5 -2
  596. package/src/components/block-controls/hook.js +3 -3
  597. package/src/components/block-draggable/style.scss +19 -4
  598. package/src/components/block-icon/index.js +4 -1
  599. package/src/components/block-icon/index.native.js +10 -16
  600. package/src/components/block-inspector/index.js +10 -0
  601. package/src/components/block-list/block-html.js +5 -0
  602. package/src/components/block-list/block.js +11 -3
  603. package/src/components/block-list/block.native.js +5 -3
  604. package/src/components/block-list/index.native.js +1 -1
  605. package/src/components/block-list/style.scss +15 -0
  606. package/src/components/block-list/use-block-props/use-multi-selection.js +27 -7
  607. package/src/components/block-list-appender/index.js +8 -0
  608. package/src/components/block-mover/index.js +4 -4
  609. package/src/components/block-mover/index.native.js +4 -4
  610. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +10 -6
  611. package/src/components/block-mover/test/index.native.js +26 -28
  612. package/src/components/block-navigation/dropdown.js +0 -1
  613. package/src/components/block-patterns-list/index.js +1 -8
  614. package/src/components/block-patterns-list/style.scss +22 -12
  615. package/src/components/block-preview/README.md +1 -1
  616. package/src/components/block-preview/auto.js +1 -1
  617. package/src/components/block-preview/style.scss +0 -17
  618. package/src/components/block-settings/container.native.js +7 -0
  619. package/src/components/block-settings-menu/block-settings-dropdown.js +26 -13
  620. package/src/components/block-settings-menu-controls/index.js +9 -6
  621. package/src/components/block-styles/preview.native.js +2 -2
  622. package/src/components/block-switcher/block-styles-menu.js +1 -1
  623. package/src/components/block-switcher/index.js +7 -3
  624. package/src/components/block-switcher/test/__snapshots__/index.js.snap +1 -1
  625. package/src/components/block-switcher/test/index.js +3 -0
  626. package/src/components/block-title/index.js +5 -2
  627. package/src/components/block-tools/block-popover.js +3 -5
  628. package/src/components/block-tools/index.js +5 -2
  629. package/src/components/block-tools/insertion-point.js +97 -9
  630. package/src/components/block-tools/style.scss +4 -35
  631. package/src/components/block-types-list/style.scss +0 -3
  632. package/src/components/border-radius-control/index.js +1 -0
  633. package/src/components/border-radius-control/test/utils.js +216 -0
  634. package/src/components/border-radius-control/utils.js +18 -10
  635. package/src/components/color-palette/test/__snapshots__/control.js.snap +128 -71
  636. package/src/components/colors/test/utils.js +41 -0
  637. package/src/components/colors/utils.js +9 -5
  638. package/src/components/colors-gradients/control.js +70 -110
  639. package/src/components/colors-gradients/panel-color-gradient-settings.js +79 -7
  640. package/src/components/colors-gradients/style.scss +10 -18
  641. package/src/components/colors-gradients/test/control.js +41 -66
  642. package/src/components/contrast-checker/index.js +14 -10
  643. package/src/components/copy-handler/index.js +6 -1
  644. package/src/components/default-block-appender/index.js +2 -2
  645. package/src/components/default-block-appender/test/__snapshots__/index.js.snap +3 -3
  646. package/src/components/duotone-control/index.js +49 -41
  647. package/src/components/duotone-control/style.scss +27 -12
  648. package/src/components/editor-styles/index.js +7 -4
  649. package/src/components/font-appearance-control/index.js +41 -33
  650. package/src/components/font-appearance-control/style.scss +1 -1
  651. package/src/components/iframe/index.js +4 -4
  652. package/src/components/image-editor/aspect-ratio-dropdown.js +129 -0
  653. package/src/components/image-editor/constants.js +6 -0
  654. package/src/components/image-editor/context.js +56 -0
  655. package/src/components/image-editor/cropper.js +74 -0
  656. package/src/components/image-editor/form-controls.js +22 -0
  657. package/src/components/image-editor/index.js +52 -0
  658. package/src/components/image-editor/rotation-button.js +24 -0
  659. package/src/components/image-editor/use-save-image.js +97 -0
  660. package/src/components/image-editor/use-transform-image.js +162 -0
  661. package/src/components/image-editor/zoom-dropdown.js +40 -0
  662. package/src/components/image-size-control/use-dimension-handler.js +18 -1
  663. package/src/components/index.js +7 -6
  664. package/src/components/index.native.js +1 -4
  665. package/src/components/inner-blocks/button-block-appender.js +9 -0
  666. package/src/components/inner-blocks/index.js +8 -4
  667. package/src/components/inner-blocks/index.native.js +7 -4
  668. package/src/components/inner-blocks/use-nested-settings-update.js +26 -11
  669. package/src/components/inserter/block-patterns-explorer/explorer.js +50 -0
  670. package/src/components/inserter/block-patterns-explorer/patterns-list.js +122 -0
  671. package/src/components/inserter/block-patterns-explorer/sidebar.js +73 -0
  672. package/src/components/inserter/block-patterns-tab.js +107 -73
  673. package/src/components/inserter/block-types-tab.native.js +3 -15
  674. package/src/components/inserter/hooks/use-block-type-impressions.native.js +14 -21
  675. package/src/components/inserter/hooks/use-clipboard-block.native.js +3 -2
  676. package/src/components/inserter/index.js +15 -3
  677. package/src/components/inserter/index.native.js +2 -19
  678. package/src/components/inserter/library.js +2 -0
  679. package/src/components/inserter/menu.js +4 -1
  680. package/src/components/inserter/menu.native.js +9 -14
  681. package/src/components/inserter/pattern-panel.js +33 -16
  682. package/src/components/inserter/preview-panel.js +1 -1
  683. package/src/components/inserter/quick-inserter.js +1 -1
  684. package/src/components/inserter/reusable-blocks-tab.native.js +4 -6
  685. package/src/components/inserter/search-results.native.js +5 -15
  686. package/src/components/inserter/style.scss +80 -16
  687. package/src/components/inserter/test/block-types-tab.native.js +1 -1
  688. package/src/components/inserter/test/fixtures/index.native.js +12 -0
  689. package/src/components/inserter/utils.native.js +35 -0
  690. package/src/components/inserter-list-item/style.scss +4 -2
  691. package/src/components/inspector-controls/block-support-slot-container.js +10 -0
  692. package/src/components/inspector-controls/block-support-tools-panel.js +60 -0
  693. package/src/components/inspector-controls/fill.js +23 -2
  694. package/src/components/inspector-controls/groups.js +8 -0
  695. package/src/components/inspector-controls/slot.js +15 -0
  696. package/src/components/letter-spacing-control/index.js +12 -6
  697. package/src/components/link-control/README.md +47 -14
  698. package/src/components/link-control/index.js +102 -31
  699. package/src/components/link-control/link-preview.js +53 -20
  700. package/src/components/link-control/search-input.js +21 -7
  701. package/src/components/link-control/style.scss +66 -19
  702. package/src/components/link-control/test/index.js +311 -4
  703. package/src/components/list-view/block-contents.js +17 -38
  704. package/src/components/list-view/block.js +73 -84
  705. package/src/components/list-view/branch.js +123 -94
  706. package/src/components/list-view/index.js +82 -30
  707. package/src/components/list-view/leaf.js +2 -2
  708. package/src/components/list-view/list-item.js +5 -4
  709. package/src/components/list-view/style.scss +70 -33
  710. package/src/components/list-view/use-list-view-client-ids.js +9 -68
  711. package/src/components/media-placeholder/index.js +26 -19
  712. package/src/components/media-replace-flow/README.md +7 -0
  713. package/src/components/media-replace-flow/index.js +4 -1
  714. package/src/components/media-upload/README.md +1 -1
  715. package/src/components/navigable-toolbar/index.js +1 -4
  716. package/src/components/observe-typing/index.js +3 -2
  717. package/src/components/plain-text/index.native.js +26 -4
  718. package/src/components/rich-text/embed-handler-picker.native.js +68 -0
  719. package/src/components/rich-text/format-edit.js +36 -2
  720. package/src/components/rich-text/format-toolbar/index.js +25 -6
  721. package/src/components/rich-text/index.js +12 -8
  722. package/src/components/rich-text/index.native.js +35 -1
  723. package/src/components/rich-text/use-paste-handler.js +30 -12
  724. package/src/components/rich-text/utils.js +16 -0
  725. package/src/components/skip-to-selected-block/README.md +39 -0
  726. package/src/components/typewriter/index.js +3 -2
  727. package/src/components/url-input/index.js +26 -10
  728. package/src/components/use-moving-animation/index.js +9 -8
  729. package/src/components/use-on-block-drop/index.js +5 -1
  730. package/src/components/use-setting/index.js +49 -11
  731. package/src/components/writing-flow/use-multi-selection.js +6 -0
  732. package/src/components/writing-flow/use-tab-nav.js +17 -3
  733. package/src/hooks/align.js +19 -10
  734. package/src/hooks/anchor.js +2 -2
  735. package/src/hooks/border.js +8 -11
  736. package/src/hooks/color-panel.js +4 -1
  737. package/src/hooks/color.js +7 -4
  738. package/src/hooks/dimensions.js +48 -59
  739. package/src/hooks/duotone.js +68 -19
  740. package/src/hooks/font-appearance.js +38 -7
  741. package/src/hooks/font-family.js +129 -33
  742. package/src/hooks/font-size.js +42 -6
  743. package/src/hooks/gap.js +2 -1
  744. package/src/hooks/index.js +2 -0
  745. package/src/hooks/index.native.js +1 -0
  746. package/src/hooks/layout.scss +8 -0
  747. package/src/hooks/letter-spacing.js +35 -7
  748. package/src/hooks/line-height.js +37 -9
  749. package/src/hooks/lock.js +34 -0
  750. package/src/hooks/margin.js +1 -1
  751. package/src/hooks/padding.js +1 -1
  752. package/src/hooks/style.js +15 -11
  753. package/src/hooks/text-decoration.js +34 -6
  754. package/src/hooks/text-transform.js +34 -6
  755. package/src/hooks/typography.js +165 -15
  756. package/src/hooks/typography.scss +16 -0
  757. package/src/hooks/use-cached-truthy.js +20 -0
  758. package/src/index.js +1 -0
  759. package/src/layouts/flex.js +179 -50
  760. package/src/layouts/flow.js +54 -8
  761. package/src/store/actions.js +239 -377
  762. package/src/store/defaults.native.js +12 -0
  763. package/src/store/index.js +1 -2
  764. package/src/store/reducer.js +54 -18
  765. package/src/store/selectors.js +173 -47
  766. package/src/store/test/actions.js +407 -705
  767. package/src/store/test/reducer.js +22 -54
  768. package/src/store/test/selectors.js +79 -21
  769. package/src/style.scss +2 -1
  770. package/src/utils/index.js +1 -0
  771. package/src/utils/parse-css-unit-to-px.js +43 -1
  772. package/src/utils/test/parse-css-unit-to-px.js +148 -165
  773. package/src/utils/transform-styles/transforms/test/wrap.js +1 -1
  774. package/src/utils/transform-styles/transforms/wrap.js +16 -0
  775. package/tsconfig.tsbuildinfo +1 -1
  776. package/build/components/duotone-control/duotone-picker-popover.js +0 -44
  777. package/build/components/duotone-control/duotone-picker-popover.js.map +0 -1
  778. package/build/components/list-view/block-slot.js +0 -121
  779. package/build/components/list-view/block-slot.js.map +0 -1
  780. package/build/components/list-view/editor.js +0 -35
  781. package/build/components/list-view/editor.js.map +0 -1
  782. package/build/components/text-decoration-and-transform/index.js +0 -39
  783. package/build/components/text-decoration-and-transform/index.js.map +0 -1
  784. package/build/store/controls.js +0 -44
  785. package/build/store/controls.js.map +0 -1
  786. package/build-module/components/duotone-control/duotone-picker-popover.js +0 -35
  787. package/build-module/components/duotone-control/duotone-picker-popover.js.map +0 -1
  788. package/build-module/components/list-view/block-slot.js +0 -96
  789. package/build-module/components/list-view/block-slot.js.map +0 -1
  790. package/build-module/components/list-view/editor.js +0 -25
  791. package/build-module/components/list-view/editor.js.map +0 -1
  792. package/build-module/components/text-decoration-and-transform/index.js +0 -30
  793. package/build-module/components/text-decoration-and-transform/index.js.map +0 -1
  794. package/build-module/store/controls.js +0 -32
  795. package/build-module/store/controls.js.map +0 -1
  796. package/src/components/duotone-control/duotone-picker-popover.js +0 -36
  797. package/src/components/list-view/block-slot.js +0 -120
  798. package/src/components/list-view/editor.js +0 -29
  799. package/src/components/text-decoration-and-transform/index.js +0 -36
  800. package/src/components/text-decoration-and-transform/style.scss +0 -3
  801. package/src/store/controls.js +0 -39
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/list-view/block-contents.js"],"names":["classnames","useSelect","forwardRef","useListViewContext","ListViewBlockSlot","ListViewBlockSelectButton","BlockDraggable","store","blockEditorStore","ListViewBlockContents","onClick","onToggleExpanded","block","isSelected","position","siblingBlockCount","level","props","ref","__experimentalFeatures","clientId","blockMovingClientId","selectedBlockInBlockEditor","select","getBlockRootClientId","hasBlockMovingClientId","getSelectedBlockClientId","rootClientId","isBlockMoveTarget","className","draggable","onDragStart","onDragEnd"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,UAAT,QAA2B,oBAA3B;AAEA;AACA;AACA;;AACA,SAASC,kBAAT,QAAmC,WAAnC;AACA,OAAOC,iBAAP,MAA8B,cAA9B;AACA,OAAOC,yBAAP,MAAsC,uBAAtC;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA,MAAMC,qBAAqB,GAAGP,UAAU,CACvC,CACC;AACCQ,EAAAA,OADD;AAECC,EAAAA,gBAFD;AAGCC,EAAAA,KAHD;AAICC,EAAAA,UAJD;AAKCC,EAAAA,QALD;AAMCC,EAAAA,iBAND;AAOCC,EAAAA,KAPD;AAQC,KAAGC;AARJ,CADD,EAWCC,GAXD,KAYK;AACJ,QAAM;AAAEC,IAAAA;AAAF,MAA6BhB,kBAAkB,EAArD;AAEA,QAAM;AAAEiB,IAAAA;AAAF,MAAeR,KAArB;AAEA,QAAM;AAAES,IAAAA,mBAAF;AAAuBC,IAAAA;AAAvB,MAAsDrB,SAAS,CAClEsB,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,oBADK;AAELC,MAAAA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,UANd;AAOC,IAAA,QAAQ,EAAGC,QAPZ;AAQC,IAAA,iBAAiB,EAAGC,iBARrB;AASC,IAAA,KAAK,EAAGC,KATT;AAUC,IAAA,SAAS,EAAGc,SAVb;AAWC,IAAA,WAAW,EAAGC,WAXf;AAYC,IAAA,SAAS,EAAGC;AAZb,KAaMf,KAbN,EAlBH,CADD;AAsCA,CA/EsC,CAAxC;AAkFA,eAAeR,qBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useListViewContext } from './context';\nimport ListViewBlockSlot from './block-slot';\nimport ListViewBlockSelectButton from './block-select-button';\nimport BlockDraggable from '../block-draggable';\nimport { store as blockEditorStore } from '../../store';\n\nconst ListViewBlockContents = forwardRef(\n\t(\n\t\t{\n\t\t\tonClick,\n\t\t\tonToggleExpanded,\n\t\t\tblock,\n\t\t\tisSelected,\n\t\t\tposition,\n\t\t\tsiblingBlockCount,\n\t\t\tlevel,\n\t\t\t...props\n\t\t},\n\t\tref\n\t) => {\n\t\tconst { __experimentalFeatures } = useListViewContext();\n\n\t\tconst { clientId } = block;\n\n\t\tconst { blockMovingClientId, selectedBlockInBlockEditor } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetBlockRootClientId,\n\t\t\t\t\thasBlockMovingClientId,\n\t\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\t} = select( blockEditorStore );\n\t\t\t\treturn {\n\t\t\t\t\trootClientId: getBlockRootClientId( clientId ) || '',\n\t\t\t\t\tblockMovingClientId: hasBlockMovingClientId(),\n\t\t\t\t\tselectedBlockInBlockEditor: getSelectedBlockClientId(),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientId ]\n\t\t);\n\n\t\tconst isBlockMoveTarget =\n\t\t\tblockMovingClientId && selectedBlockInBlockEditor === clientId;\n\n\t\tconst className = classnames( 'block-editor-list-view-block-contents', {\n\t\t\t'is-dropping-before': isBlockMoveTarget,\n\t\t} );\n\n\t\treturn (\n\t\t\t<BlockDraggable clientIds={ [ block.clientId ] }>\n\t\t\t\t{ ( { draggable, onDragStart, onDragEnd } ) =>\n\t\t\t\t\t__experimentalFeatures ? (\n\t\t\t\t\t\t<ListViewBlockSlot\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\tonToggleExpanded={ onToggleExpanded }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\t\tsiblingBlockCount={ siblingBlockCount }\n\t\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\t\tdraggable={ draggable && __experimentalFeatures }\n\t\t\t\t\t\t\tonDragStart={ onDragStart }\n\t\t\t\t\t\t\tonDragEnd={ onDragEnd }\n\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<ListViewBlockSelectButton\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t\t\tonToggleExpanded={ onToggleExpanded }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\t\tsiblingBlockCount={ siblingBlockCount }\n\t\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\t\tdraggable={ draggable }\n\t\t\t\t\t\t\tonDragStart={ onDragStart }\n\t\t\t\t\t\t\tonDragEnd={ onDragEnd }\n\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t</BlockDraggable>\n\t\t);\n\t}\n);\n\nexport default ListViewBlockContents;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/list-view/block-contents.js"],"names":["classnames","useSelect","forwardRef","ListViewBlockSelectButton","BlockDraggable","store","blockEditorStore","ListViewBlockContents","onClick","onToggleExpanded","block","isSelected","position","siblingBlockCount","level","props","ref","clientId","blockMovingClientId","selectedBlockInBlockEditor","select","getBlockRootClientId","hasBlockMovingClientId","getSelectedBlockClientId","rootClientId","isBlockMoveTarget","className","draggable","onDragStart","onDragEnd"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,UAAT,QAA2B,oBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,yBAAP,MAAsC,uBAAtC;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA,MAAMC,qBAAqB,GAAGL,UAAU,CACvC,CACC;AACCM,EAAAA,OADD;AAECC,EAAAA,gBAFD;AAGCC,EAAAA,KAHD;AAICC,EAAAA,UAJD;AAKCC,EAAAA,QALD;AAMCC,EAAAA,iBAND;AAOCC,EAAAA,KAPD;AAQC,KAAGC;AARJ,CADD,EAWCC,GAXD,KAYK;AACJ,QAAM;AAAEC,IAAAA;AAAF,MAAeP,KAArB;AAEA,QAAM;AAAEQ,IAAAA,mBAAF;AAAuBC,IAAAA;AAAvB,MAAsDlB,SAAS,CAClEmB,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,oBADK;AAELC,MAAAA,sBAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAEd,gBAAF,CAJV;AAKA,WAAO;AACNkB,MAAAA,YAAY,EAAEH,oBAAoB,CAAEJ,QAAF,CAApB,IAAoC,EAD5C;AAENC,MAAAA,mBAAmB,EAAEI,sBAAsB,EAFrC;AAGNH,MAAAA,0BAA0B,EAAEI,wBAAwB;AAH9C,KAAP;AAKA,GAZmE,EAapE,CAAEN,QAAF,CAboE,CAArE;AAgBA,QAAMQ,iBAAiB,GACtBP,mBAAmB,IAAIC,0BAA0B,KAAKF,QADvD;AAGA,QAAMS,SAAS,GAAG1B,UAAU,CAAE,uCAAF,EAA2C;AACtE,0BAAsByB;AADgD,GAA3C,CAA5B;AAIA,SACC,cAAC,cAAD;AAAgB,IAAA,SAAS,EAAG,CAAEf,KAAK,CAACO,QAAR;AAA5B,KACG,CAAE;AAAEU,IAAAA,SAAF;AAAaC,IAAAA,WAAb;AAA0BC,IAAAA;AAA1B,GAAF,KACD,cAAC,yBAAD;AACC,IAAA,GAAG,EAAGb,GADP;AAEC,IAAA,SAAS,EAAGU,SAFb;AAGC,IAAA,KAAK,EAAGhB,KAHT;AAIC,IAAA,OAAO,EAAGF,OAJX;AAKC,IAAA,gBAAgB,EAAGC,gBALpB;AAMC,IAAA,UAAU,EAAGE,UANd;AAOC,IAAA,QAAQ,EAAGC,QAPZ;AAQC,IAAA,iBAAiB,EAAGC,iBARrB;AASC,IAAA,KAAK,EAAGC,KATT;AAUC,IAAA,SAAS,EAAGa,SAVb;AAWC,IAAA,WAAW,EAAGC,WAXf;AAYC,IAAA,SAAS,EAAGC;AAZb,KAaMd,KAbN,EAFF,CADD;AAqBA,CA5DsC,CAAxC;AA+DA,eAAeR,qBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ListViewBlockSelectButton from './block-select-button';\nimport BlockDraggable from '../block-draggable';\nimport { store as blockEditorStore } from '../../store';\n\nconst ListViewBlockContents = forwardRef(\n\t(\n\t\t{\n\t\t\tonClick,\n\t\t\tonToggleExpanded,\n\t\t\tblock,\n\t\t\tisSelected,\n\t\t\tposition,\n\t\t\tsiblingBlockCount,\n\t\t\tlevel,\n\t\t\t...props\n\t\t},\n\t\tref\n\t) => {\n\t\tconst { clientId } = block;\n\n\t\tconst { blockMovingClientId, selectedBlockInBlockEditor } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetBlockRootClientId,\n\t\t\t\t\thasBlockMovingClientId,\n\t\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\t} = select( blockEditorStore );\n\t\t\t\treturn {\n\t\t\t\t\trootClientId: getBlockRootClientId( clientId ) || '',\n\t\t\t\t\tblockMovingClientId: hasBlockMovingClientId(),\n\t\t\t\t\tselectedBlockInBlockEditor: getSelectedBlockClientId(),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientId ]\n\t\t);\n\n\t\tconst isBlockMoveTarget =\n\t\t\tblockMovingClientId && selectedBlockInBlockEditor === clientId;\n\n\t\tconst className = classnames( 'block-editor-list-view-block-contents', {\n\t\t\t'is-dropping-before': isBlockMoveTarget,\n\t\t} );\n\n\t\treturn (\n\t\t\t<BlockDraggable clientIds={ [ block.clientId ] }>\n\t\t\t\t{ ( { draggable, onDragStart, onDragEnd } ) => (\n\t\t\t\t\t<ListViewBlockSelectButton\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t\tonToggleExpanded={ onToggleExpanded }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\tsiblingBlockCount={ siblingBlockCount }\n\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\tdraggable={ draggable }\n\t\t\t\t\t\tonDragStart={ onDragStart }\n\t\t\t\t\t\tonDragEnd={ onDragEnd }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockDraggable>\n\t\t);\n\t}\n);\n\nexport default ListViewBlockContents;\n"]}
@@ -8,11 +8,10 @@ import classnames from 'classnames';
8
8
  * WordPress dependencies
9
9
  */
10
10
 
11
- import { __experimentalTreeGridCell as TreeGridCell, __experimentalTreeGridItem as TreeGridItem, MenuGroup, MenuItem } from '@wordpress/components';
12
- import { __ } from '@wordpress/i18n';
11
+ import { __experimentalTreeGridCell as TreeGridCell, __experimentalTreeGridItem as TreeGridItem } from '@wordpress/components';
13
12
  import { moreVertical } from '@wordpress/icons';
14
- import { useState, useRef, useEffect } from '@wordpress/element';
15
- import { useDispatch, useSelect } from '@wordpress/data';
13
+ import { useState, useRef, useEffect, useCallback, memo } from '@wordpress/element';
14
+ import { useDispatch } from '@wordpress/data';
16
15
  /**
17
16
  * Internal dependencies
18
17
  */
@@ -23,13 +22,13 @@ import ListViewBlockContents from './block-contents';
23
22
  import BlockSettingsDropdown from '../block-settings-menu/block-settings-dropdown';
24
23
  import { useListViewContext } from './context';
25
24
  import { store as blockEditorStore } from '../../store';
26
- export default function ListViewBlock({
25
+
26
+ function ListViewBlock({
27
27
  block,
28
+ isDragged,
28
29
  isSelected,
29
30
  isBranchSelected,
30
- isLastOfSelectedBranch,
31
- onClick,
32
- onToggleExpanded,
31
+ selectBlock,
33
32
  position,
34
33
  level,
35
34
  rowCount,
@@ -44,35 +43,23 @@ export default function ListViewBlock({
44
43
  clientId
45
44
  } = block;
46
45
  const {
47
- isDragging,
48
- blockParents
49
- } = useSelect(select => {
50
- const {
51
- isBlockBeingDragged,
52
- isAncestorBeingDragged,
53
- getBlockParents
54
- } = select(blockEditorStore);
55
- return {
56
- isDragging: isBlockBeingDragged(clientId) || isAncestorBeingDragged(clientId),
57
- blockParents: getBlockParents(clientId)
58
- };
59
- }, [clientId]);
60
- const {
61
- selectBlock: selectEditorBlock,
62
46
  toggleBlockHighlight
63
47
  } = useDispatch(blockEditorStore);
64
- const hasSiblings = siblingBlockCount > 0;
65
- const hasRenderedMovers = showBlockMovers && hasSiblings;
66
- const moverCellClassName = classnames('block-editor-list-view-block__mover-cell', {
67
- 'is-visible': isHovered
68
- });
69
48
  const {
70
49
  __experimentalFeatures: withExperimentalFeatures,
71
50
  __experimentalPersistentListViewFeatures: withExperimentalPersistentListViewFeatures,
72
- isTreeGridMounted
51
+ __experimentalHideContainerBlockActions: hideContainerBlockActions,
52
+ isTreeGridMounted,
53
+ expand,
54
+ collapse
73
55
  } = useListViewContext();
56
+ const hasSiblings = siblingBlockCount > 0;
57
+ const hasRenderedMovers = showBlockMovers && hasSiblings;
58
+ const moverCellClassName = classnames('block-editor-list-view-block__mover-cell', {
59
+ 'is-visible': isHovered || isSelected
60
+ });
74
61
  const listViewBlockSettingsClassName = classnames('block-editor-list-view-block__menu-cell', {
75
- 'is-visible': isHovered
62
+ 'is-visible': isHovered || isSelected
76
63
  }); // If ListView has experimental features related to the Persistent List View,
77
64
  // only focus the selected list item on mount; otherwise the list would always
78
65
  // try to steal the focus from the editor canvas.
@@ -81,31 +68,45 @@ export default function ListViewBlock({
81
68
  if (withExperimentalPersistentListViewFeatures && !isTreeGridMounted && isSelected) {
82
69
  cellRef.current.focus();
83
70
  }
84
- }, []); // If ListView has experimental features (such as drag and drop) enabled,
85
- // leave the focus handling as it was before, to avoid accidental regressions.
86
-
87
- useEffect(() => {
88
- if (withExperimentalFeatures && isSelected) {
89
- cellRef.current.focus();
90
- }
91
- }, [withExperimentalFeatures, isSelected]);
71
+ }, []);
92
72
  const highlightBlock = withExperimentalPersistentListViewFeatures ? toggleBlockHighlight : () => {};
93
-
94
- const onMouseEnter = () => {
73
+ const onMouseEnter = useCallback(() => {
95
74
  setIsHovered(true);
96
75
  highlightBlock(clientId, true);
97
- };
98
-
99
- const onMouseLeave = () => {
76
+ }, [clientId, setIsHovered, highlightBlock]);
77
+ const onMouseLeave = useCallback(() => {
100
78
  setIsHovered(false);
101
79
  highlightBlock(clientId, false);
102
- };
80
+ }, [clientId, setIsHovered, highlightBlock]);
81
+ const selectEditorBlock = useCallback(event => {
82
+ event.stopPropagation();
83
+ selectBlock(clientId);
84
+ }, [clientId, selectBlock]);
85
+ const toggleExpanded = useCallback(event => {
86
+ event.stopPropagation();
87
+
88
+ if (isExpanded === true) {
89
+ collapse(clientId);
90
+ } else if (isExpanded === false) {
91
+ expand(clientId);
92
+ }
93
+ }, [clientId, expand, collapse, isExpanded]);
94
+ const showBlockActions = withExperimentalFeatures && ( //hide actions for blocks like core/widget-areas
95
+ !hideContainerBlockActions || hideContainerBlockActions && level > 1);
96
+ const hideBlockActions = withExperimentalFeatures && !showBlockActions;
97
+ let colSpan;
98
+
99
+ if (hasRenderedMovers) {
100
+ colSpan = 2;
101
+ } else if (hideBlockActions) {
102
+ colSpan = 3;
103
+ }
103
104
 
104
105
  const classes = classnames({
105
106
  'is-selected': isSelected,
106
107
  'is-branch-selected': withExperimentalPersistentListViewFeatures && isBranchSelected,
107
- 'is-last-of-selected-branch': withExperimentalPersistentListViewFeatures && isLastOfSelectedBranch,
108
- 'is-dragging': isDragging
108
+ 'is-dragging': isDragged,
109
+ 'has-single-cell': hideBlockActions
109
110
  });
110
111
  return createElement(ListViewLeaf, {
111
112
  className: classes,
@@ -122,7 +123,7 @@ export default function ListViewBlock({
122
123
  isExpanded: isExpanded
123
124
  }, createElement(TreeGridCell, {
124
125
  className: "block-editor-list-view-block__contents-cell",
125
- colSpan: hasRenderedMovers ? undefined : 2,
126
+ colSpan: colSpan,
126
127
  ref: cellRef
127
128
  }, ({
128
129
  ref,
@@ -132,8 +133,8 @@ export default function ListViewBlock({
132
133
  className: "block-editor-list-view-block__contents-container"
133
134
  }, createElement(ListViewBlockContents, {
134
135
  block: block,
135
- onClick: onClick,
136
- onToggleExpanded: onToggleExpanded,
136
+ onClick: selectEditorBlock,
137
+ onToggleExpanded: toggleExpanded,
137
138
  isSelected: isSelected,
138
139
  position: position,
139
140
  siblingBlockCount: siblingBlockCount,
@@ -164,7 +165,7 @@ export default function ListViewBlock({
164
165
  ref: ref,
165
166
  tabIndex: tabIndex,
166
167
  onFocus: onFocus
167
- })))), withExperimentalFeatures && createElement(TreeGridCell, {
168
+ })))), showBlockActions && createElement(TreeGridCell, {
168
169
  className: listViewBlockSettingsClassName
169
170
  }, ({
170
171
  ref,
@@ -175,30 +176,14 @@ export default function ListViewBlock({
175
176
  icon: moreVertical,
176
177
  toggleProps: {
177
178
  ref,
179
+ className: 'block-editor-list-view-block__menu',
178
180
  tabIndex,
179
181
  onFocus
180
182
  },
181
183
  disableOpenOnArrowDown: true,
182
- __experimentalSelectBlock: onClick
183
- }, ({
184
- onClose
185
- }) => createElement(MenuGroup, null, createElement(MenuItem, {
186
- onClick: async () => {
187
- if (blockParents.length) {
188
- // If the block to select is inside a dropdown, we need to open the dropdown.
189
- // Otherwise focus won't transfer to the block.
190
- for (const parent of blockParents) {
191
- await selectEditorBlock(parent);
192
- }
193
- } else {
194
- // If clientId is already selected, it won't be focused (see block-wrapper.js)
195
- // This removes the selection first to ensure the focus will always switch.
196
- await selectEditorBlock(null);
197
- }
198
-
199
- await selectEditorBlock(clientId);
200
- onClose();
201
- }
202
- }, __('Go to block'))))));
184
+ __experimentalSelectBlock: selectEditorBlock
185
+ })));
203
186
  }
187
+
188
+ export default memo(ListViewBlock);
204
189
  //# sourceMappingURL=block.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/list-view/block.js"],"names":["classnames","__experimentalTreeGridCell","TreeGridCell","__experimentalTreeGridItem","TreeGridItem","MenuGroup","MenuItem","__","moreVertical","useState","useRef","useEffect","useDispatch","useSelect","ListViewLeaf","BlockMoverUpButton","BlockMoverDownButton","ListViewBlockContents","BlockSettingsDropdown","useListViewContext","store","blockEditorStore","ListViewBlock","block","isSelected","isBranchSelected","isLastOfSelectedBranch","onClick","onToggleExpanded","position","level","rowCount","siblingBlockCount","showBlockMovers","path","isExpanded","cellRef","isHovered","setIsHovered","clientId","isDragging","blockParents","select","isBlockBeingDragged","isAncestorBeingDragged","getBlockParents","selectBlock","selectEditorBlock","toggleBlockHighlight","hasSiblings","hasRenderedMovers","moverCellClassName","__experimentalFeatures","withExperimentalFeatures","__experimentalPersistentListViewFeatures","withExperimentalPersistentListViewFeatures","isTreeGridMounted","listViewBlockSettingsClassName","current","focus","highlightBlock","onMouseEnter","onMouseLeave","classes","undefined","ref","tabIndex","onFocus","onClose","length","parent"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,0BAA0B,IAAIC,YAD/B,EAECC,0BAA0B,IAAIC,YAF/B,EAGCC,SAHD,EAICC,QAJD,QAKO,uBALP;AAMA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,YAAT,QAA6B,kBAA7B;AACA,SAASC,QAAT,EAAmBC,MAAnB,EAA2BC,SAA3B,QAA4C,oBAA5C;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,QAAzB;AACA,SACCC,kBADD,EAECC,oBAFD,QAGO,uBAHP;AAIA,OAAOC,qBAAP,MAAkC,kBAAlC;AACA,OAAOC,qBAAP,MAAkC,gDAAlC;AACA,SAASC,kBAAT,QAAmC,WAAnC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA,eAAe,SAASC,aAAT,CAAwB;AACtCC,EAAAA,KADsC;AAEtCC,EAAAA,UAFsC;AAGtCC,EAAAA,gBAHsC;AAItCC,EAAAA,sBAJsC;AAKtCC,EAAAA,OALsC;AAMtCC,EAAAA,gBANsC;AAOtCC,EAAAA,QAPsC;AAQtCC,EAAAA,KARsC;AAStCC,EAAAA,QATsC;AAUtCC,EAAAA,iBAVsC;AAWtCC,EAAAA,eAXsC;AAYtCC,EAAAA,IAZsC;AAatCC,EAAAA;AAbsC,CAAxB,EAcX;AACH,QAAMC,OAAO,GAAG1B,MAAM,CAAE,IAAF,CAAtB;AACA,QAAM,CAAE2B,SAAF,EAAaC,YAAb,IAA8B7B,QAAQ,CAAE,KAAF,CAA5C;AACA,QAAM;AAAE8B,IAAAA;AAAF,MAAehB,KAArB;AACA,QAAM;AAAEiB,IAAAA,UAAF;AAA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AAjB,GAAF,KACD,cAAC,qBAAD;AACC,IAAA,SAAS,EAAG,CAAE5B,QAAF,CADb;AAEC,IAAA,IAAI,EAAG/B,YAFR;AAGC,IAAA,WAAW,EAAG;AACbyD,MAAAA,GADa;AAEbC,MAAAA,QAFa;AAGbC,MAAAA;AAHa,KAHf;AAQC,IAAA,sBAAsB,MARvB;AASC,IAAA,yBAAyB,EAAGxC;AAT7B,KAWG,CAAE;AAAEyC,IAAAA;AAAF,GAAF,KACD,cAAC,SAAD,QACC,cAAC,QAAD;AACC,IAAA,OAAO,EAAG,YAAY;AACrB,UAAK3B,YAAY,CAAC4B,MAAlB,EAA2B;AAC1B;AACA;AACA,aAAM,MAAMC,MAAZ,IAAsB7B,YAAtB,EAAqC;AACpC,gBAAMM,iBAAiB,CACtBuB,MADsB,CAAvB;AAGA;AACD,OARD,MAQO;AACN;AACA;AACA,cAAMvB,iBAAiB,CAAE,IAAF,CAAvB;AACA;;AACD,YAAMA,iBAAiB,CAAER,QAAF,CAAvB;AACA6B,MAAAA,OAAO;AACP;AAjBF,KAmBG7D,EAAE,CAAE,aAAF,CAnBL,CADD,CAZF,CAFF,CArEF,CADD;AAkHA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalTreeGridCell as TreeGridCell,\n\t__experimentalTreeGridItem as TreeGridItem,\n\tMenuGroup,\n\tMenuItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { moreVertical } from '@wordpress/icons';\nimport { useState, useRef, useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport ListViewLeaf from './leaf';\nimport {\n\tBlockMoverUpButton,\n\tBlockMoverDownButton,\n} from '../block-mover/button';\nimport ListViewBlockContents from './block-contents';\nimport BlockSettingsDropdown from '../block-settings-menu/block-settings-dropdown';\nimport { useListViewContext } from './context';\nimport { store as blockEditorStore } from '../../store';\n\nexport default function ListViewBlock( {\n\tblock,\n\tisSelected,\n\tisBranchSelected,\n\tisLastOfSelectedBranch,\n\tonClick,\n\tonToggleExpanded,\n\tposition,\n\tlevel,\n\trowCount,\n\tsiblingBlockCount,\n\tshowBlockMovers,\n\tpath,\n\tisExpanded,\n} ) {\n\tconst cellRef = useRef( null );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst { clientId } = block;\n\tconst { isDragging, blockParents } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisBlockBeingDragged,\n\t\t\t\tisAncestorBeingDragged,\n\t\t\t\tgetBlockParents,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\tisDragging:\n\t\t\t\t\tisBlockBeingDragged( clientId ) ||\n\t\t\t\t\tisAncestorBeingDragged( clientId ),\n\t\t\t\tblockParents: getBlockParents( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst {\n\t\tselectBlock: selectEditorBlock,\n\t\ttoggleBlockHighlight,\n\t} = useDispatch( blockEditorStore );\n\n\tconst hasSiblings = siblingBlockCount > 0;\n\tconst hasRenderedMovers = showBlockMovers && hasSiblings;\n\tconst moverCellClassName = classnames(\n\t\t'block-editor-list-view-block__mover-cell',\n\t\t{ 'is-visible': isHovered }\n\t);\n\tconst {\n\t\t__experimentalFeatures: withExperimentalFeatures,\n\t\t__experimentalPersistentListViewFeatures: withExperimentalPersistentListViewFeatures,\n\t\tisTreeGridMounted,\n\t} = useListViewContext();\n\tconst listViewBlockSettingsClassName = classnames(\n\t\t'block-editor-list-view-block__menu-cell',\n\t\t{ 'is-visible': isHovered }\n\t);\n\n\t// If ListView has experimental features related to the Persistent List View,\n\t// only focus the selected list item on mount; otherwise the list would always\n\t// try to steal the focus from the editor canvas.\n\tuseEffect( () => {\n\t\tif (\n\t\t\twithExperimentalPersistentListViewFeatures &&\n\t\t\t! isTreeGridMounted &&\n\t\t\tisSelected\n\t\t) {\n\t\t\tcellRef.current.focus();\n\t\t}\n\t}, [] );\n\n\t// If ListView has experimental features (such as drag and drop) enabled,\n\t// leave the focus handling as it was before, to avoid accidental regressions.\n\tuseEffect( () => {\n\t\tif ( withExperimentalFeatures && isSelected ) {\n\t\t\tcellRef.current.focus();\n\t\t}\n\t}, [ withExperimentalFeatures, isSelected ] );\n\n\tconst highlightBlock = withExperimentalPersistentListViewFeatures\n\t\t? toggleBlockHighlight\n\t\t: () => {};\n\n\tconst onMouseEnter = () => {\n\t\tsetIsHovered( true );\n\t\thighlightBlock( clientId, true );\n\t};\n\tconst onMouseLeave = () => {\n\t\tsetIsHovered( false );\n\t\thighlightBlock( clientId, false );\n\t};\n\n\tconst classes = classnames( {\n\t\t'is-selected': isSelected,\n\t\t'is-branch-selected':\n\t\t\twithExperimentalPersistentListViewFeatures && isBranchSelected,\n\t\t'is-last-of-selected-branch':\n\t\t\twithExperimentalPersistentListViewFeatures &&\n\t\t\tisLastOfSelectedBranch,\n\t\t'is-dragging': isDragging,\n\t} );\n\n\treturn (\n\t\t<ListViewLeaf\n\t\t\tclassName={ classes }\n\t\t\tonMouseEnter={ onMouseEnter }\n\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\tonFocus={ onMouseEnter }\n\t\t\tonBlur={ onMouseLeave }\n\t\t\tlevel={ level }\n\t\t\tposition={ position }\n\t\t\trowCount={ rowCount }\n\t\t\tpath={ path }\n\t\t\tid={ `list-view-block-${ clientId }` }\n\t\t\tdata-block={ clientId }\n\t\t\tisExpanded={ isExpanded }\n\t\t>\n\t\t\t<TreeGridCell\n\t\t\t\tclassName=\"block-editor-list-view-block__contents-cell\"\n\t\t\t\tcolSpan={ hasRenderedMovers ? undefined : 2 }\n\t\t\t\tref={ cellRef }\n\t\t\t>\n\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t<div className=\"block-editor-list-view-block__contents-container\">\n\t\t\t\t\t\t<ListViewBlockContents\n\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t\t\tonToggleExpanded={ onToggleExpanded }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\t\tsiblingBlockCount={ siblingBlockCount }\n\t\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</TreeGridCell>\n\t\t\t{ hasRenderedMovers && (\n\t\t\t\t<>\n\t\t\t\t\t<TreeGridCell\n\t\t\t\t\t\tclassName={ moverCellClassName }\n\t\t\t\t\t\twithoutGridItem\n\t\t\t\t\t>\n\t\t\t\t\t\t<TreeGridItem>\n\t\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t\t<BlockMoverUpButton\n\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridItem>\n\t\t\t\t\t\t<TreeGridItem>\n\t\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t\t<BlockMoverDownButton\n\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridItem>\n\t\t\t\t\t</TreeGridCell>\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ withExperimentalFeatures && (\n\t\t\t\t<TreeGridCell className={ listViewBlockSettingsClassName }>\n\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t<BlockSettingsDropdown\n\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\t\ttabIndex,\n\t\t\t\t\t\t\t\tonFocus,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tdisableOpenOnArrowDown\n\t\t\t\t\t\t\t__experimentalSelectBlock={ onClick }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ async () => {\n\t\t\t\t\t\t\t\t\t\t\tif ( blockParents.length ) {\n\t\t\t\t\t\t\t\t\t\t\t\t// If the block to select is inside a dropdown, we need to open the dropdown.\n\t\t\t\t\t\t\t\t\t\t\t\t// Otherwise focus won't transfer to the block.\n\t\t\t\t\t\t\t\t\t\t\t\tfor ( const parent of blockParents ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tawait selectEditorBlock(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tparent\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t// If clientId is already selected, it won't be focused (see block-wrapper.js)\n\t\t\t\t\t\t\t\t\t\t\t\t// This removes the selection first to ensure the focus will always switch.\n\t\t\t\t\t\t\t\t\t\t\t\tawait selectEditorBlock( null );\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tawait selectEditorBlock( clientId );\n\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Go to block' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</BlockSettingsDropdown>\n\t\t\t\t\t) }\n\t\t\t\t</TreeGridCell>\n\t\t\t) }\n\t\t</ListViewLeaf>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/list-view/block.js"],"names":["classnames","__experimentalTreeGridCell","TreeGridCell","__experimentalTreeGridItem","TreeGridItem","moreVertical","useState","useRef","useEffect","useCallback","memo","useDispatch","ListViewLeaf","BlockMoverUpButton","BlockMoverDownButton","ListViewBlockContents","BlockSettingsDropdown","useListViewContext","store","blockEditorStore","ListViewBlock","block","isDragged","isSelected","isBranchSelected","selectBlock","position","level","rowCount","siblingBlockCount","showBlockMovers","path","isExpanded","cellRef","isHovered","setIsHovered","clientId","toggleBlockHighlight","__experimentalFeatures","withExperimentalFeatures","__experimentalPersistentListViewFeatures","withExperimentalPersistentListViewFeatures","__experimentalHideContainerBlockActions","hideContainerBlockActions","isTreeGridMounted","expand","collapse","hasSiblings","hasRenderedMovers","moverCellClassName","listViewBlockSettingsClassName","current","focus","highlightBlock","onMouseEnter","onMouseLeave","selectEditorBlock","event","stopPropagation","toggleExpanded","showBlockActions","hideBlockActions","colSpan","classes","ref","tabIndex","onFocus","className"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,0BAA0B,IAAIC,YAD/B,EAECC,0BAA0B,IAAIC,YAF/B,QAGO,uBAHP;AAIA,SAASC,YAAT,QAA6B,kBAA7B;AACA,SACCC,QADD,EAECC,MAFD,EAGCC,SAHD,EAICC,WAJD,E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AAP;AAAiBC,IAAAA;AAAjB,GAAF,KACD,cAAC,qBAAD;AACC,IAAA,SAAS,EAAG,CAAE9B,QAAF,CADb;AAEC,IAAA,IAAI,EAAG/B,YAFR;AAGC,IAAA,WAAW,EAAG;AACb2D,MAAAA,GADa;AAEbG,MAAAA,SAAS,EAAE,oCAFE;AAGbF,MAAAA,QAHa;AAIbC,MAAAA;AAJa,KAHf;AASC,IAAA,sBAAsB,MATvB;AAUC,IAAA,yBAAyB,EAAGV;AAV7B,IAFF,CArEF,CADD;AAyFA;;AAED,eAAe9C,IAAI,CAAEU,aAAF,CAAnB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalTreeGridCell as TreeGridCell,\n\t__experimentalTreeGridItem as TreeGridItem,\n} from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport {\n\tuseState,\n\tuseRef,\n\tuseEffect,\n\tuseCallback,\n\tmemo,\n} from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport ListViewLeaf from './leaf';\nimport {\n\tBlockMoverUpButton,\n\tBlockMoverDownButton,\n} from '../block-mover/button';\nimport ListViewBlockContents from './block-contents';\nimport BlockSettingsDropdown from '../block-settings-menu/block-settings-dropdown';\nimport { useListViewContext } from './context';\nimport { store as blockEditorStore } from '../../store';\n\nfunction ListViewBlock( {\n\tblock,\n\tisDragged,\n\tisSelected,\n\tisBranchSelected,\n\tselectBlock,\n\tposition,\n\tlevel,\n\trowCount,\n\tsiblingBlockCount,\n\tshowBlockMovers,\n\tpath,\n\tisExpanded,\n} ) {\n\tconst cellRef = useRef( null );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst { clientId } = block;\n\n\tconst { toggleBlockHighlight } = useDispatch( blockEditorStore );\n\n\tconst {\n\t\t__experimentalFeatures: withExperimentalFeatures,\n\t\t__experimentalPersistentListViewFeatures: withExperimentalPersistentListViewFeatures,\n\t\t__experimentalHideContainerBlockActions: hideContainerBlockActions,\n\t\tisTreeGridMounted,\n\t\texpand,\n\t\tcollapse,\n\t} = useListViewContext();\n\n\tconst hasSiblings = siblingBlockCount > 0;\n\tconst hasRenderedMovers = showBlockMovers && hasSiblings;\n\tconst moverCellClassName = classnames(\n\t\t'block-editor-list-view-block__mover-cell',\n\t\t{ 'is-visible': isHovered || isSelected }\n\t);\n\n\tconst listViewBlockSettingsClassName = classnames(\n\t\t'block-editor-list-view-block__menu-cell',\n\t\t{ 'is-visible': isHovered || isSelected }\n\t);\n\n\t// If ListView has experimental features related to the Persistent List View,\n\t// only focus the selected list item on mount; otherwise the list would always\n\t// try to steal the focus from the editor canvas.\n\tuseEffect( () => {\n\t\tif (\n\t\t\twithExperimentalPersistentListViewFeatures &&\n\t\t\t! isTreeGridMounted &&\n\t\t\tisSelected\n\t\t) {\n\t\t\tcellRef.current.focus();\n\t\t}\n\t}, [] );\n\n\tconst highlightBlock = withExperimentalPersistentListViewFeatures\n\t\t? toggleBlockHighlight\n\t\t: () => {};\n\n\tconst onMouseEnter = useCallback( () => {\n\t\tsetIsHovered( true );\n\t\thighlightBlock( clientId, true );\n\t}, [ clientId, setIsHovered, highlightBlock ] );\n\tconst onMouseLeave = useCallback( () => {\n\t\tsetIsHovered( false );\n\t\thighlightBlock( clientId, false );\n\t}, [ clientId, setIsHovered, highlightBlock ] );\n\n\tconst selectEditorBlock = useCallback(\n\t\t( event ) => {\n\t\t\tevent.stopPropagation();\n\t\t\tselectBlock( clientId );\n\t\t},\n\t\t[ clientId, selectBlock ]\n\t);\n\n\tconst toggleExpanded = useCallback(\n\t\t( event ) => {\n\t\t\tevent.stopPropagation();\n\t\t\tif ( isExpanded === true ) {\n\t\t\t\tcollapse( clientId );\n\t\t\t} else if ( isExpanded === false ) {\n\t\t\t\texpand( clientId );\n\t\t\t}\n\t\t},\n\t\t[ clientId, expand, collapse, isExpanded ]\n\t);\n\n\tconst showBlockActions =\n\t\twithExperimentalFeatures &&\n\t\t//hide actions for blocks like core/widget-areas\n\t\t( ! hideContainerBlockActions ||\n\t\t\t( hideContainerBlockActions && level > 1 ) );\n\n\tconst hideBlockActions = withExperimentalFeatures && ! showBlockActions;\n\n\tlet colSpan;\n\tif ( hasRenderedMovers ) {\n\t\tcolSpan = 2;\n\t} else if ( hideBlockActions ) {\n\t\tcolSpan = 3;\n\t}\n\n\tconst classes = classnames( {\n\t\t'is-selected': isSelected,\n\t\t'is-branch-selected':\n\t\t\twithExperimentalPersistentListViewFeatures && isBranchSelected,\n\t\t'is-dragging': isDragged,\n\t\t'has-single-cell': hideBlockActions,\n\t} );\n\n\treturn (\n\t\t<ListViewLeaf\n\t\t\tclassName={ classes }\n\t\t\tonMouseEnter={ onMouseEnter }\n\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\tonFocus={ onMouseEnter }\n\t\t\tonBlur={ onMouseLeave }\n\t\t\tlevel={ level }\n\t\t\tposition={ position }\n\t\t\trowCount={ rowCount }\n\t\t\tpath={ path }\n\t\t\tid={ `list-view-block-${ clientId }` }\n\t\t\tdata-block={ clientId }\n\t\t\tisExpanded={ isExpanded }\n\t\t>\n\t\t\t<TreeGridCell\n\t\t\t\tclassName=\"block-editor-list-view-block__contents-cell\"\n\t\t\t\tcolSpan={ colSpan }\n\t\t\t\tref={ cellRef }\n\t\t\t>\n\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t<div className=\"block-editor-list-view-block__contents-container\">\n\t\t\t\t\t\t<ListViewBlockContents\n\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\tonClick={ selectEditorBlock }\n\t\t\t\t\t\t\tonToggleExpanded={ toggleExpanded }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\t\tsiblingBlockCount={ siblingBlockCount }\n\t\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</TreeGridCell>\n\t\t\t{ hasRenderedMovers && (\n\t\t\t\t<>\n\t\t\t\t\t<TreeGridCell\n\t\t\t\t\t\tclassName={ moverCellClassName }\n\t\t\t\t\t\twithoutGridItem\n\t\t\t\t\t>\n\t\t\t\t\t\t<TreeGridItem>\n\t\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t\t<BlockMoverUpButton\n\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridItem>\n\t\t\t\t\t\t<TreeGridItem>\n\t\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t\t<BlockMoverDownButton\n\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridItem>\n\t\t\t\t\t</TreeGridCell>\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ showBlockActions && (\n\t\t\t\t<TreeGridCell className={ listViewBlockSettingsClassName }>\n\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t<BlockSettingsDropdown\n\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\t\tclassName: 'block-editor-list-view-block__menu',\n\t\t\t\t\t\t\t\ttabIndex,\n\t\t\t\t\t\t\t\tonFocus,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tdisableOpenOnArrowDown\n\t\t\t\t\t\t\t__experimentalSelectBlock={ selectEditorBlock }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</TreeGridCell>\n\t\t\t) }\n\t\t</ListViewLeaf>\n\t);\n}\n\nexport default memo( ListViewBlock );\n"]}
@@ -1,131 +1,155 @@
1
- import { createElement } from "@wordpress/element";
1
+ import { createElement, Fragment } from "@wordpress/element";
2
2
 
3
3
  /**
4
4
  * External dependencies
5
5
  */
6
- import { map, compact } from 'lodash';
6
+ import { compact } from 'lodash';
7
7
  /**
8
8
  * WordPress dependencies
9
9
  */
10
10
 
11
- import { Fragment } from '@wordpress/element';
11
+ import { memo } from '@wordpress/element';
12
+ import { AsyncModeProvider } from '@wordpress/data';
12
13
  /**
13
14
  * Internal dependencies
14
15
  */
15
16
 
16
17
  import ListViewBlock from './block';
17
- import ListViewAppender from './appender';
18
- import { isClientIdSelected } from './utils';
19
18
  import { useListViewContext } from './context';
20
- export default function ListViewBranch(props) {
19
+ import { isClientIdSelected } from './utils';
20
+ /**
21
+ * Given a block, returns the total number of blocks in that subtree. This is used to help determine
22
+ * the list position of a block.
23
+ *
24
+ * When a block is collapsed, we do not count their children as part of that total. In the current drag
25
+ * implementation dragged blocks and their children are not counted.
26
+ *
27
+ * @param {Object} block block tree
28
+ * @param {Object} expandedState state that notes which branches are collapsed
29
+ * @param {Array} draggedClientIds a list of dragged client ids
30
+ * @return {number} block count
31
+ */
32
+
33
+ function countBlocks(block, expandedState, draggedClientIds) {
34
+ var _expandedState$block$;
35
+
36
+ const isDragged = draggedClientIds === null || draggedClientIds === void 0 ? void 0 : draggedClientIds.includes(block.clientId);
37
+
38
+ if (isDragged) {
39
+ return 0;
40
+ }
41
+
42
+ const isExpanded = (_expandedState$block$ = expandedState[block.clientId]) !== null && _expandedState$block$ !== void 0 ? _expandedState$block$ : true;
43
+
44
+ if (isExpanded) {
45
+ return 1 + block.innerBlocks.reduce(countReducer(expandedState, draggedClientIds), 0);
46
+ }
47
+
48
+ return 1;
49
+ }
50
+
51
+ const countReducer = (expandedState, draggedClientIds) => (count, block) => {
52
+ var _expandedState$block$2;
53
+
54
+ const isDragged = draggedClientIds === null || draggedClientIds === void 0 ? void 0 : draggedClientIds.includes(block.clientId);
55
+
56
+ if (isDragged) {
57
+ return count;
58
+ }
59
+
60
+ const isExpanded = (_expandedState$block$2 = expandedState[block.clientId]) !== null && _expandedState$block$2 !== void 0 ? _expandedState$block$2 : true;
61
+
62
+ if (isExpanded && block.innerBlocks.length > 0) {
63
+ return count + countBlocks(block, expandedState, draggedClientIds);
64
+ }
65
+
66
+ return count + 1;
67
+ };
68
+
69
+ function ListViewBranch(props) {
21
70
  const {
22
71
  blocks,
23
72
  selectBlock,
24
- selectedBlockClientIds,
25
- showAppender,
26
73
  showBlockMovers,
27
74
  showNestedBlocks,
28
- parentBlockClientId,
75
+ selectedClientIds,
29
76
  level = 1,
30
- terminatedLevels = [],
31
- path = [],
77
+ path = '',
32
78
  isBranchSelected = false,
33
- isLastOfBranch = false
79
+ listPosition = 0,
80
+ fixedListWindow
34
81
  } = props;
35
- const isTreeRoot = !parentBlockClientId;
36
- const filteredBlocks = compact(blocks);
37
-
38
- const itemHasAppender = parentClientId => showAppender && !isTreeRoot && isClientIdSelected(parentClientId, selectedBlockClientIds);
39
-
40
- const hasAppender = itemHasAppender(parentBlockClientId); // Add +1 to the rowCount to take the block appender into account.
41
-
42
- const blockCount = filteredBlocks.length;
43
- const rowCount = hasAppender ? blockCount + 1 : blockCount;
44
- const appenderPosition = rowCount;
45
82
  const {
46
83
  expandedState,
47
- expand,
48
- collapse
84
+ draggedClientIds,
85
+ __experimentalPersistentListViewFeatures
49
86
  } = useListViewContext();
50
- return createElement(Fragment, null, map(filteredBlocks, (block, index) => {
87
+ const filteredBlocks = compact(blocks);
88
+ const blockCount = filteredBlocks.length;
89
+ let nextPosition = listPosition;
90
+ return createElement(Fragment, null, filteredBlocks.map((block, index) => {
51
91
  var _expandedState$client;
52
92
 
53
93
  const {
54
94
  clientId,
55
95
  innerBlocks
56
96
  } = block;
97
+
98
+ if (index > 0) {
99
+ nextPosition += countBlocks(filteredBlocks[index - 1], expandedState, draggedClientIds);
100
+ }
101
+
102
+ const usesWindowing = __experimentalPersistentListViewFeatures;
103
+ const {
104
+ itemInView
105
+ } = fixedListWindow;
106
+ const blockInView = !usesWindowing || itemInView(nextPosition);
57
107
  const position = index + 1;
58
- const isLastRowAtLevel = rowCount === position;
59
- const updatedTerminatedLevels = isLastRowAtLevel ? [...terminatedLevels, level] : terminatedLevels;
60
- const updatedPath = [...path, position];
108
+ const updatedPath = path.length > 0 ? `${path}_${position}` : `${position}`;
61
109
  const hasNestedBlocks = showNestedBlocks && !!innerBlocks && !!innerBlocks.length;
62
- const hasNestedAppender = itemHasAppender(clientId);
63
- const hasNestedBranch = hasNestedBlocks || hasNestedAppender;
64
- const isSelected = isClientIdSelected(clientId, selectedBlockClientIds);
65
- const isSelectedBranch = isBranchSelected || isSelected && hasNestedBranch; // Logic needed to target the last item of a selected branch which might be deeply nested.
66
- // This is currently only needed for styling purposes. See: `.is-last-of-selected-branch`.
67
-
68
- const isLastBlock = index === blockCount - 1;
69
- const isLast = isSelected || isLastOfBranch && isLastBlock;
70
- const isLastOfSelectedBranch = isLastOfBranch && !hasNestedBranch && isLastBlock;
71
- const isExpanded = hasNestedBranch ? (_expandedState$client = expandedState[clientId]) !== null && _expandedState$client !== void 0 ? _expandedState$client : true : undefined;
72
-
73
- const selectBlockWithClientId = event => {
74
- event.stopPropagation();
75
- selectBlock(clientId);
76
- };
77
-
78
- const toggleExpanded = event => {
79
- event.stopPropagation();
80
-
81
- if (isExpanded === true) {
82
- collapse(clientId);
83
- } else if (isExpanded === false) {
84
- expand(clientId);
85
- }
86
- };
87
-
88
- return createElement(Fragment, {
89
- key: clientId
90
- }, createElement(ListViewBlock, {
110
+ const isExpanded = hasNestedBlocks ? (_expandedState$client = expandedState[clientId]) !== null && _expandedState$client !== void 0 ? _expandedState$client : true : undefined;
111
+ const isDragged = !!(draggedClientIds !== null && draggedClientIds !== void 0 && draggedClientIds.includes(clientId));
112
+ const showBlock = isDragged || blockInView; // Make updates to the selected or dragged blocks synchronous,
113
+ // but asynchronous for any other block.
114
+
115
+ const isSelected = isClientIdSelected(clientId, selectedClientIds);
116
+ const isSelectedBranch = isBranchSelected || isSelected && hasNestedBlocks;
117
+ return createElement(AsyncModeProvider, {
118
+ key: clientId,
119
+ value: !isSelected
120
+ }, showBlock && createElement(ListViewBlock, {
91
121
  block: block,
92
- onClick: selectBlockWithClientId,
93
- onToggleExpanded: toggleExpanded,
122
+ selectBlock: selectBlock,
94
123
  isSelected: isSelected,
95
124
  isBranchSelected: isSelectedBranch,
96
- isLastOfSelectedBranch: isLastOfSelectedBranch,
125
+ isDragged: isDragged,
97
126
  level: level,
98
127
  position: position,
99
- rowCount: rowCount,
128
+ rowCount: blockCount,
100
129
  siblingBlockCount: blockCount,
101
130
  showBlockMovers: showBlockMovers,
102
- terminatedLevels: terminatedLevels,
103
131
  path: updatedPath,
104
- isExpanded: isExpanded
105
- }), hasNestedBranch && isExpanded && createElement(ListViewBranch, {
132
+ isExpanded: isExpanded,
133
+ listPosition: nextPosition
134
+ }), !showBlock && createElement("tr", null, createElement("td", {
135
+ className: "block-editor-list-view-placeholder"
136
+ })), hasNestedBlocks && isExpanded && !isDragged && createElement(ListViewBranch, {
106
137
  blocks: innerBlocks,
107
- selectedBlockClientIds: selectedBlockClientIds,
108
138
  selectBlock: selectBlock,
109
- isBranchSelected: isSelectedBranch,
110
- isLastOfBranch: isLast,
111
- showAppender: showAppender,
112
139
  showBlockMovers: showBlockMovers,
113
140
  showNestedBlocks: showNestedBlocks,
114
- parentBlockClientId: clientId,
115
141
  level: level + 1,
116
- terminatedLevels: updatedTerminatedLevels,
117
- path: updatedPath
142
+ path: updatedPath,
143
+ listPosition: nextPosition + 1,
144
+ fixedListWindow: fixedListWindow,
145
+ isBranchSelected: isSelectedBranch,
146
+ selectedClientIds: selectedClientIds
118
147
  }));
119
- }), hasAppender && createElement(ListViewAppender, {
120
- parentBlockClientId: parentBlockClientId,
121
- position: rowCount,
122
- rowCount: appenderPosition,
123
- level: level,
124
- terminatedLevels: terminatedLevels,
125
- path: [...path, appenderPosition]
126
148
  }));
127
149
  }
150
+
128
151
  ListViewBranch.defaultProps = {
129
152
  selectBlock: () => {}
130
153
  };
154
+ export default memo(ListViewBranch);
131
155
  //# sourceMappingURL=branch.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/list-view/branch.js"],"names":["map","compact","Fragment","ListViewBlock","ListViewAppender","isClientIdSelected","useListViewContext","ListViewBranch","props","blocks","selectBlock","selectedBlockClientIds","showAppender","showBlockMovers","showNestedBlocks","parentBlockClientId","level","terminatedLevels","path","isBranchSelected","isLastOfBranch","isTreeRoot","filteredBlocks","itemHasAppender","parentClientId","hasAppender","blockCount","length","rowCount","appenderPosition","expandedState","expand","collapse","block","index","clientId","innerBlocks","position","isLastRowAtLevel","updatedTerminatedLevels","updatedPath","hasNestedBlocks","hasNestedAppender","hasNestedBranch","isSelected","isSelectedBranch","isLastBlock","isLast","isLastOfSelectedBranch","isExpanded","undefined","selectBlockWithClientId","event","stopPropagation","toggleExpanded","defaultProps"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,OAAd,QAA6B,QAA7B;AAEA;AACA;AACA;;AACA,SAASC,QAAT,QAAyB,oBAAzB;AAEA;AACA;AACA;;AACA,OAAOC,aAAP,MAA0B,SAA1B;AACA,OAAOC,gBAAP,MAA6B,YAA7B;AACA,SAASC,kBAAT,QAAmC,SAA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L,EAAWW,gBAAX;AANR,IAtFF,CADD;AAkGA;AAEDtB,cAAc,CAACgD,YAAf,GAA8B;AAC7B7C,EAAAA,WAAW,EAAE,MAAM,CAAE;AADQ,CAA9B","sourcesContent":["/**\n * External dependencies\n */\nimport { map, compact } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Fragment } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ListViewBlock from './block';\nimport ListViewAppender from './appender';\nimport { isClientIdSelected } from './utils';\nimport { useListViewContext } from './context';\n\nexport default function ListViewBranch( props ) {\n\tconst {\n\t\tblocks,\n\t\tselectBlock,\n\t\tselectedBlockClientIds,\n\t\tshowAppender,\n\t\tshowBlockMovers,\n\t\tshowNestedBlocks,\n\t\tparentBlockClientId,\n\t\tlevel = 1,\n\t\tterminatedLevels = [],\n\t\tpath = [],\n\t\tisBranchSelected = false,\n\t\tisLastOfBranch = false,\n\t} = props;\n\n\tconst isTreeRoot = ! parentBlockClientId;\n\tconst filteredBlocks = compact( blocks );\n\tconst itemHasAppender = ( parentClientId ) =>\n\t\tshowAppender &&\n\t\t! isTreeRoot &&\n\t\tisClientIdSelected( parentClientId, selectedBlockClientIds );\n\tconst hasAppender = itemHasAppender( parentBlockClientId );\n\t// Add +1 to the rowCount to take the block appender into account.\n\tconst blockCount = filteredBlocks.length;\n\tconst rowCount = hasAppender ? blockCount + 1 : blockCount;\n\tconst appenderPosition = rowCount;\n\n\tconst { expandedState, expand, collapse } = useListViewContext();\n\n\treturn (\n\t\t<>\n\t\t\t{ map( filteredBlocks, ( block, index ) => {\n\t\t\t\tconst { clientId, innerBlocks } = block;\n\t\t\t\tconst position = index + 1;\n\t\t\t\tconst isLastRowAtLevel = rowCount === position;\n\t\t\t\tconst updatedTerminatedLevels = isLastRowAtLevel\n\t\t\t\t\t? [ ...terminatedLevels, level ]\n\t\t\t\t\t: terminatedLevels;\n\t\t\t\tconst updatedPath = [ ...path, position ];\n\t\t\t\tconst hasNestedBlocks =\n\t\t\t\t\tshowNestedBlocks && !! innerBlocks && !! innerBlocks.length;\n\t\t\t\tconst hasNestedAppender = itemHasAppender( clientId );\n\t\t\t\tconst hasNestedBranch = hasNestedBlocks || hasNestedAppender;\n\n\t\t\t\tconst isSelected = isClientIdSelected(\n\t\t\t\t\tclientId,\n\t\t\t\t\tselectedBlockClientIds\n\t\t\t\t);\n\t\t\t\tconst isSelectedBranch =\n\t\t\t\t\tisBranchSelected || ( isSelected && hasNestedBranch );\n\n\t\t\t\t// Logic needed to target the last item of a selected branch which might be deeply nested.\n\t\t\t\t// This is currently only needed for styling purposes. See: `.is-last-of-selected-branch`.\n\t\t\t\tconst isLastBlock = index === blockCount - 1;\n\t\t\t\tconst isLast = isSelected || ( isLastOfBranch && isLastBlock );\n\t\t\t\tconst isLastOfSelectedBranch =\n\t\t\t\t\tisLastOfBranch && ! hasNestedBranch && isLastBlock;\n\n\t\t\t\tconst isExpanded = hasNestedBranch\n\t\t\t\t\t? expandedState[ clientId ] ?? true\n\t\t\t\t\t: undefined;\n\n\t\t\t\tconst selectBlockWithClientId = ( event ) => {\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tselectBlock( clientId );\n\t\t\t\t};\n\n\t\t\t\tconst toggleExpanded = ( event ) => {\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tif ( isExpanded === true ) {\n\t\t\t\t\t\tcollapse( clientId );\n\t\t\t\t\t} else if ( isExpanded === false ) {\n\t\t\t\t\t\texpand( clientId );\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\treturn (\n\t\t\t\t\t<Fragment key={ clientId }>\n\t\t\t\t\t\t<ListViewBlock\n\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\tonClick={ selectBlockWithClientId }\n\t\t\t\t\t\t\tonToggleExpanded={ toggleExpanded }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tisBranchSelected={ isSelectedBranch }\n\t\t\t\t\t\t\tisLastOfSelectedBranch={ isLastOfSelectedBranch }\n\t\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\t\trowCount={ rowCount }\n\t\t\t\t\t\t\tsiblingBlockCount={ blockCount }\n\t\t\t\t\t\t\tshowBlockMovers={ showBlockMovers }\n\t\t\t\t\t\t\tterminatedLevels={ terminatedLevels }\n\t\t\t\t\t\t\tpath={ updatedPath }\n\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ hasNestedBranch && isExpanded && (\n\t\t\t\t\t\t\t<ListViewBranch\n\t\t\t\t\t\t\t\tblocks={ innerBlocks }\n\t\t\t\t\t\t\t\tselectedBlockClientIds={\n\t\t\t\t\t\t\t\t\tselectedBlockClientIds\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tselectBlock={ selectBlock }\n\t\t\t\t\t\t\t\tisBranchSelected={ isSelectedBranch }\n\t\t\t\t\t\t\t\tisLastOfBranch={ isLast }\n\t\t\t\t\t\t\t\tshowAppender={ showAppender }\n\t\t\t\t\t\t\t\tshowBlockMovers={ showBlockMovers }\n\t\t\t\t\t\t\t\tshowNestedBlocks={ showNestedBlocks }\n\t\t\t\t\t\t\t\tparentBlockClientId={ clientId }\n\t\t\t\t\t\t\t\tlevel={ level + 1 }\n\t\t\t\t\t\t\t\tterminatedLevels={ updatedTerminatedLevels }\n\t\t\t\t\t\t\t\tpath={ updatedPath }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Fragment>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t\t{ hasAppender && (\n\t\t\t\t<ListViewAppender\n\t\t\t\t\tparentBlockClientId={ parentBlockClientId }\n\t\t\t\t\tposition={ rowCount }\n\t\t\t\t\trowCount={ appenderPosition }\n\t\t\t\t\tlevel={ level }\n\t\t\t\t\tterminatedLevels={ terminatedLevels }\n\t\t\t\t\tpath={ [ ...path, appenderPosition ] }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nListViewBranch.defaultProps = {\n\tselectBlock: () => {},\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/list-view/branch.js"],"names":["compact","memo","AsyncModeProvider","ListViewBlock","useListViewContext","isClientIdSelected","countBlocks","block","expandedState","draggedClientIds","isDragged","includes","clientId","isExpanded","innerBlocks","reduce","countReducer","count","length","ListViewBranch","props","blocks","selectBlock","showBlockMovers","showNestedBlocks","selectedClientIds","level","path","isBranchSelected","listPosition","fixedListWindow","__experimentalPersistentListViewFeatures","filteredBlocks","blockCount","nextPosition","map","index","usesWindowing","itemInView","blockInView","position","updatedPath","hasNestedBlocks","undefined","showBlock","isSelected","isSelectedBranch","defaultProps"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,QAAxB;AAEA;AACA;AACA;;AACA,SAASC,IAAT,QAAqB,oBAArB;AACA,SAASC,iBAAT,QAAkC,iBAAlC;AAEA;AACA;AACA;;AACA,OAAOC,aAAP,MAA0B,SAA1B;AACA,SAASC,kBAAT,QAAmC,WAAnC;AACA,SAASC,kBAAT,QAAmC,SAAnC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,WAAT,CAAsBC,KAAtB,EAA6BC,aAA7B,EAA4CC,gBAA5C,EAA+D;AAAA;;AAC9D,QAAMC,SAAS,GAAGD,gBAAH,aAAGA,gBAAH,uBAAGA,gBAAgB,CAAEE,QAAlB,CAA4BJ,KAAK,CAACK,QAAlC,CAAlB;;AACA,MAAKF,SAAL,EAAiB;AAChB,WAAO,CAAP;AACA;;AACD,QAAMG,UAAU,4BAAGL,aAAa,CAAED,KAAK,CAACK,QAAR,CAAhB,yEAAsC,IAAtD;;AACA,MAAKC,UAAL,EAAkB;AACjB,WACC,IACAN,KAAK,CAACO,WAAN,CAAkBC,MAAlB,CACCC,YAAY,CAAER,aAAF,EAAiBC,gBAAjB,CADb,EA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;AACC,MAAA,KAAK,EAAGrC,KADT;AAEC,MAAA,WAAW,EAAGe,WAFf;AAGC,MAAA,UAAU,EAAGuB,UAHd;AAIC,MAAA,gBAAgB,EAAGC,gBAJpB;AAKC,MAAA,SAAS,EAAGpC,SALb;AAMC,MAAA,KAAK,EAAGgB,KANT;AAOC,MAAA,QAAQ,EAAGc,QAPZ;AAQC,MAAA,QAAQ,EAAGP,UARZ;AASC,MAAA,iBAAiB,EAAGA,UATrB;AAUC,MAAA,eAAe,EAAGV,eAVnB;AAWC,MAAA,IAAI,EAAGkB,WAXR;AAYC,MAAA,UAAU,EAAG5B,UAZd;AAaC,MAAA,YAAY,EAAGqB;AAbhB,MAFF,EAkBG,CAAEU,SAAF,IACD,0BACC;AAAI,MAAA,SAAS,EAAC;AAAd,MADD,CAnBF,EAuBGF,eAAe,IAAI7B,UAAnB,IAAiC,CAAEH,SAAnC,IACD,cAAC,cAAD;AACC,MAAA,MAAM,EAAGI,WADV;AAEC,MAAA,WAAW,EAAGQ,WAFf;AAGC,MAAA,eAAe,EAAGC,eAHnB;AAIC,MAAA,gBAAgB,EAAGC,gBAJpB;AAKC,MAAA,KAAK,EAAGE,KAAK,GAAG,CALjB;AAMC,MAAA,IAAI,EAAGe,WANR;AAOC,MAAA,YAAY,EAAGP,YAAY,GAAG,CAP/B;AAQC,MAAA,eAAe,EAAGJ,eARnB;AASC,MAAA,gBAAgB,EAAGgB,gBATpB;AAUC,MAAA,iBAAiB,EAAGrB;AAVrB,MAxBF,CADD;AAwCA,GAlFC,CADH,CADD;AAuFA;;AAEDN,cAAc,CAAC4B,YAAf,GAA8B;AAC7BzB,EAAAA,WAAW,EAAE,MAAM,CAAE;AADQ,CAA9B;AAIA,eAAerB,IAAI,CAAEkB,cAAF,CAAnB","sourcesContent":["/**\n * External dependencies\n */\nimport { compact } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { memo } from '@wordpress/element';\nimport { AsyncModeProvider } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport ListViewBlock from './block';\nimport { useListViewContext } from './context';\nimport { isClientIdSelected } from './utils';\n\n/**\n * Given a block, returns the total number of blocks in that subtree. This is used to help determine\n * the list position of a block.\n *\n * When a block is collapsed, we do not count their children as part of that total. In the current drag\n * implementation dragged blocks and their children are not counted.\n *\n * @param {Object} block block tree\n * @param {Object} expandedState state that notes which branches are collapsed\n * @param {Array} draggedClientIds a list of dragged client ids\n * @return {number} block count\n */\nfunction countBlocks( block, expandedState, draggedClientIds ) {\n\tconst isDragged = draggedClientIds?.includes( block.clientId );\n\tif ( isDragged ) {\n\t\treturn 0;\n\t}\n\tconst isExpanded = expandedState[ block.clientId ] ?? true;\n\tif ( isExpanded ) {\n\t\treturn (\n\t\t\t1 +\n\t\t\tblock.innerBlocks.reduce(\n\t\t\t\tcountReducer( expandedState, draggedClientIds ),\n\t\t\t\t0\n\t\t\t)\n\t\t);\n\t}\n\treturn 1;\n}\nconst countReducer = ( expandedState, draggedClientIds ) => (\n\tcount,\n\tblock\n) => {\n\tconst isDragged = draggedClientIds?.includes( block.clientId );\n\tif ( isDragged ) {\n\t\treturn count;\n\t}\n\tconst isExpanded = expandedState[ block.clientId ] ?? true;\n\tif ( isExpanded && block.innerBlocks.length > 0 ) {\n\t\treturn count + countBlocks( block, expandedState, draggedClientIds );\n\t}\n\treturn count + 1;\n};\n\nfunction ListViewBranch( props ) {\n\tconst {\n\t\tblocks,\n\t\tselectBlock,\n\t\tshowBlockMovers,\n\t\tshowNestedBlocks,\n\t\tselectedClientIds,\n\t\tlevel = 1,\n\t\tpath = '',\n\t\tisBranchSelected = false,\n\t\tlistPosition = 0,\n\t\tfixedListWindow,\n\t} = props;\n\n\tconst {\n\t\texpandedState,\n\t\tdraggedClientIds,\n\t\t__experimentalPersistentListViewFeatures,\n\t} = useListViewContext();\n\n\tconst filteredBlocks = compact( blocks );\n\tconst blockCount = filteredBlocks.length;\n\tlet nextPosition = listPosition;\n\n\treturn (\n\t\t<>\n\t\t\t{ filteredBlocks.map( ( block, index ) => {\n\t\t\t\tconst { clientId, innerBlocks } = block;\n\n\t\t\t\tif ( index > 0 ) {\n\t\t\t\t\tnextPosition += countBlocks(\n\t\t\t\t\t\tfilteredBlocks[ index - 1 ],\n\t\t\t\t\t\texpandedState,\n\t\t\t\t\t\tdraggedClientIds\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst usesWindowing = __experimentalPersistentListViewFeatures;\n\n\t\t\t\tconst { itemInView } = fixedListWindow;\n\n\t\t\t\tconst blockInView =\n\t\t\t\t\t! usesWindowing || itemInView( nextPosition );\n\n\t\t\t\tconst position = index + 1;\n\t\t\t\tconst updatedPath =\n\t\t\t\t\tpath.length > 0\n\t\t\t\t\t\t? `${ path }_${ position }`\n\t\t\t\t\t\t: `${ position }`;\n\t\t\t\tconst hasNestedBlocks =\n\t\t\t\t\tshowNestedBlocks && !! innerBlocks && !! innerBlocks.length;\n\n\t\t\t\tconst isExpanded = hasNestedBlocks\n\t\t\t\t\t? expandedState[ clientId ] ?? true\n\t\t\t\t\t: undefined;\n\n\t\t\t\tconst isDragged = !! draggedClientIds?.includes( clientId );\n\n\t\t\t\tconst showBlock = isDragged || blockInView;\n\n\t\t\t\t// Make updates to the selected or dragged blocks synchronous,\n\t\t\t\t// but asynchronous for any other block.\n\t\t\t\tconst isSelected = isClientIdSelected(\n\t\t\t\t\tclientId,\n\t\t\t\t\tselectedClientIds\n\t\t\t\t);\n\t\t\t\tconst isSelectedBranch =\n\t\t\t\t\tisBranchSelected || ( isSelected && hasNestedBlocks );\n\t\t\t\treturn (\n\t\t\t\t\t<AsyncModeProvider key={ clientId } value={ ! isSelected }>\n\t\t\t\t\t\t{ showBlock && (\n\t\t\t\t\t\t\t<ListViewBlock\n\t\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\t\tselectBlock={ selectBlock }\n\t\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\t\tisBranchSelected={ isSelectedBranch }\n\t\t\t\t\t\t\t\tisDragged={ isDragged }\n\t\t\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\t\t\trowCount={ blockCount }\n\t\t\t\t\t\t\t\tsiblingBlockCount={ blockCount }\n\t\t\t\t\t\t\t\tshowBlockMovers={ showBlockMovers }\n\t\t\t\t\t\t\t\tpath={ updatedPath }\n\t\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t\t\tlistPosition={ nextPosition }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! showBlock && (\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td className=\"block-editor-list-view-placeholder\" />\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ hasNestedBlocks && isExpanded && ! isDragged && (\n\t\t\t\t\t\t\t<ListViewBranch\n\t\t\t\t\t\t\t\tblocks={ innerBlocks }\n\t\t\t\t\t\t\t\tselectBlock={ selectBlock }\n\t\t\t\t\t\t\t\tshowBlockMovers={ showBlockMovers }\n\t\t\t\t\t\t\t\tshowNestedBlocks={ showNestedBlocks }\n\t\t\t\t\t\t\t\tlevel={ level + 1 }\n\t\t\t\t\t\t\t\tpath={ updatedPath }\n\t\t\t\t\t\t\t\tlistPosition={ nextPosition + 1 }\n\t\t\t\t\t\t\t\tfixedListWindow={ fixedListWindow }\n\t\t\t\t\t\t\t\tisBranchSelected={ isSelectedBranch }\n\t\t\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</AsyncModeProvider>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nListViewBranch.defaultProps = {\n\tselectBlock: () => {},\n};\n\nexport default memo( ListViewBranch );\n"]}