@wordpress/block-editor 14.1.0 → 14.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (630) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +1 -10
  3. package/build/components/block-alignment-matrix-control/index.js +2 -2
  4. package/build/components/block-alignment-matrix-control/index.js.map +1 -1
  5. package/build/components/block-breadcrumb/index.js +8 -2
  6. package/build/components/block-breadcrumb/index.js.map +1 -1
  7. package/build/components/block-canvas/index.js +8 -1
  8. package/build/components/block-canvas/index.js.map +1 -1
  9. package/build/components/block-compare/block-view.js +4 -1
  10. package/build/components/block-compare/block-view.js.map +1 -1
  11. package/build/components/block-draggable/index.js +4 -4
  12. package/build/components/block-draggable/index.js.map +1 -1
  13. package/build/components/block-draggable/use-scroll-when-dragging.js +25 -25
  14. package/build/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
  15. package/build/components/block-edit/multiple-usage-warning.js +8 -2
  16. package/build/components/block-edit/multiple-usage-warning.js.map +1 -1
  17. package/build/components/block-inspector/index.js +27 -9
  18. package/build/components/block-inspector/index.js.map +1 -1
  19. package/build/components/block-list/block-invalid-warning.js +6 -3
  20. package/build/components/block-list/block-invalid-warning.js.map +1 -1
  21. package/build/components/block-list/block.js +5 -1
  22. package/build/components/block-list/block.js.map +1 -1
  23. package/build/components/block-list/use-block-props/index.js +5 -1
  24. package/build/components/block-list/use-block-props/index.js.map +1 -1
  25. package/build/components/block-list/use-block-props/use-focus-first-element.js +1 -0
  26. package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  27. package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js +46 -0
  28. package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -0
  29. package/build/components/block-lock/toolbar.js +3 -3
  30. package/build/components/block-lock/toolbar.js.map +1 -1
  31. package/build/components/block-mover/button.js +4 -1
  32. package/build/components/block-mover/button.js.map +1 -1
  33. package/build/components/block-mover/index.js +4 -1
  34. package/build/components/block-mover/index.js.map +1 -1
  35. package/build/components/block-navigation/dropdown.js +4 -1
  36. package/build/components/block-navigation/dropdown.js.map +1 -1
  37. package/build/components/block-pattern-setup/index.js +1 -4
  38. package/build/components/block-pattern-setup/index.js.map +1 -1
  39. package/build/components/block-pattern-setup/setup-toolbar.js +22 -7
  40. package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
  41. package/build/components/block-patterns-list/index.js +11 -14
  42. package/build/components/block-patterns-list/index.js.map +1 -1
  43. package/build/components/block-patterns-paging/index.js +12 -3
  44. package/build/components/block-patterns-paging/index.js.map +1 -1
  45. package/build/components/block-popover/index.js +2 -15
  46. package/build/components/block-popover/index.js.map +1 -1
  47. package/build/components/block-quick-navigation/index.js +4 -1
  48. package/build/components/block-quick-navigation/index.js.map +1 -1
  49. package/build/components/block-settings-menu-controls/index.js +4 -0
  50. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  51. package/build/components/block-switcher/index.js +22 -17
  52. package/build/components/block-switcher/index.js.map +1 -1
  53. package/build/components/block-switcher/pattern-transformations-menu.js +1 -4
  54. package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  55. package/build/components/block-toolbar/index.js +12 -11
  56. package/build/components/block-toolbar/index.js.map +1 -1
  57. package/build/components/block-toolbar/shuffle.js +6 -2
  58. package/build/components/block-toolbar/shuffle.js.map +1 -1
  59. package/build/components/block-tools/block-selection-button.js +8 -2
  60. package/build/components/block-tools/block-selection-button.js.map +1 -1
  61. package/build/components/block-tools/block-toolbar-popover.js +10 -6
  62. package/build/components/block-tools/block-toolbar-popover.js.map +1 -1
  63. package/build/components/block-tools/use-block-toolbar-popover-props.js +2 -1
  64. package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  65. package/build/components/block-tools/zoom-out-mode-inserters.js +4 -9
  66. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  67. package/build/components/block-tools/zoom-out-popover.js +3 -4
  68. package/build/components/block-tools/zoom-out-popover.js.map +1 -1
  69. package/build/components/block-tools/zoom-out-toolbar.js +14 -5
  70. package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
  71. package/build/components/block-variation-picker/index.js +4 -1
  72. package/build/components/block-variation-picker/index.js.map +1 -1
  73. package/build/components/block-variation-transforms/index.js +4 -1
  74. package/build/components/block-variation-transforms/index.js.map +1 -1
  75. package/build/components/button-block-appender/index.js +14 -3
  76. package/build/components/button-block-appender/index.js.map +1 -1
  77. package/build/components/colors-gradients/dropdown.js +4 -1
  78. package/build/components/colors-gradients/dropdown.js.map +1 -1
  79. package/build/components/content-lock/index.js +13 -0
  80. package/build/components/content-lock/index.js.map +1 -0
  81. package/build/components/content-lock/modify-content-lock-menu-item.js +64 -0
  82. package/build/components/content-lock/modify-content-lock-menu-item.js.map +1 -0
  83. package/build/components/editor-styles/index.js +4 -3
  84. package/build/components/editor-styles/index.js.map +1 -1
  85. package/build/components/global-styles/background-panel.js +8 -12
  86. package/build/components/global-styles/background-panel.js.map +1 -1
  87. package/build/components/global-styles/color-panel.js +8 -5
  88. package/build/components/global-styles/color-panel.js.map +1 -1
  89. package/build/components/global-styles/color-panel.native.js +1 -1
  90. package/build/components/global-styles/color-panel.native.js.map +1 -1
  91. package/build/components/global-styles/dimensions-panel.js +34 -37
  92. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  93. package/build/components/global-styles/filters-panel.js +4 -1
  94. package/build/components/global-styles/filters-panel.js.map +1 -1
  95. package/build/components/global-styles/shadow-panel-components.js +13 -7
  96. package/build/components/global-styles/shadow-panel-components.js.map +1 -1
  97. package/build/components/global-styles/typography-utils.js +17 -6
  98. package/build/components/global-styles/typography-utils.js.map +1 -1
  99. package/build/components/global-styles/utils.js +4 -6
  100. package/build/components/global-styles/utils.js.map +1 -1
  101. package/build/components/grid/grid-item-movers.js +2 -2
  102. package/build/components/grid/grid-item-movers.js.map +1 -1
  103. package/build/components/iframe/index.js +5 -5
  104. package/build/components/iframe/index.js.map +1 -1
  105. package/build/components/inner-blocks/index.js +2 -4
  106. package/build/components/inner-blocks/index.js.map +1 -1
  107. package/build/components/inner-blocks/use-inner-block-template-sync.js +3 -3
  108. package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  109. package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +4 -1
  110. package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
  111. package/build/components/inserter/block-patterns-tab/index.js +4 -1
  112. package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
  113. package/build/components/inserter/library.js +2 -4
  114. package/build/components/inserter/library.js.map +1 -1
  115. package/build/components/inserter/media-tab/hooks.js +3 -3
  116. package/build/components/inserter/media-tab/hooks.js.map +1 -1
  117. package/build/components/inserter/media-tab/media-list.js +1 -4
  118. package/build/components/inserter/media-tab/media-list.js.map +1 -1
  119. package/build/components/inserter/media-tab/media-preview.js +8 -2
  120. package/build/components/inserter/media-tab/media-preview.js.map +1 -1
  121. package/build/components/inserter/media-tab/media-tab.js +4 -1
  122. package/build/components/inserter/media-tab/media-tab.js.map +1 -1
  123. package/build/components/inserter/menu.js +7 -24
  124. package/build/components/inserter/menu.js.map +1 -1
  125. package/build/components/inserter/quick-inserter.js +4 -1
  126. package/build/components/inserter/quick-inserter.js.map +1 -1
  127. package/build/components/inserter-list-item/index.js +4 -4
  128. package/build/components/inserter-list-item/index.js.map +1 -1
  129. package/build/components/inserter-listbox/index.js +3 -7
  130. package/build/components/inserter-listbox/index.js.map +1 -1
  131. package/build/components/inserter-listbox/item.js +4 -1
  132. package/build/components/inserter-listbox/item.js.map +1 -1
  133. package/build/components/inspector-controls/groups.js +2 -0
  134. package/build/components/inspector-controls/groups.js.map +1 -1
  135. package/build/components/inspector-controls-tabs/index.js +4 -1
  136. package/build/components/inspector-controls-tabs/index.js.map +1 -1
  137. package/build/components/inspector-controls-tabs/settings-tab.js +3 -1
  138. package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -1
  139. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +2 -1
  140. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  141. package/build/components/inspector-popover-header/index.js +8 -2
  142. package/build/components/inspector-popover-header/index.js.map +1 -1
  143. package/build/components/letter-spacing-control/index.js +7 -4
  144. package/build/components/letter-spacing-control/index.js.map +1 -1
  145. package/build/components/link-control/index.js +19 -10
  146. package/build/components/link-control/index.js.map +1 -1
  147. package/build/components/link-control/settings-drawer.js +4 -1
  148. package/build/components/link-control/settings-drawer.js.map +1 -1
  149. package/build/components/list-view/block-select-button.js +4 -1
  150. package/build/components/list-view/block-select-button.js.map +1 -1
  151. package/build/components/media-placeholder/index.js +28 -7
  152. package/build/components/media-placeholder/index.js.map +1 -1
  153. package/build/components/media-replace-flow/index.js +8 -1
  154. package/build/components/media-replace-flow/index.js.map +1 -1
  155. package/build/components/provider/use-block-sync.js +19 -19
  156. package/build/components/provider/use-block-sync.js.map +1 -1
  157. package/build/components/rich-text/event-listeners/paste-handler.js +12 -1
  158. package/build/components/rich-text/event-listeners/paste-handler.js.map +1 -1
  159. package/build/components/rich-text/index.js +38 -30
  160. package/build/components/rich-text/index.js.map +1 -1
  161. package/build/components/rich-text/use-mark-persistent.js +5 -5
  162. package/build/components/rich-text/use-mark-persistent.js.map +1 -1
  163. package/build/components/skip-to-selected-block/index.js +4 -1
  164. package/build/components/skip-to-selected-block/index.js.map +1 -1
  165. package/build/components/tool-selector/index.js +4 -1
  166. package/build/components/tool-selector/index.js.map +1 -1
  167. package/build/components/url-input/button.js +12 -3
  168. package/build/components/url-input/button.js.map +1 -1
  169. package/build/components/url-input/index.js +4 -1
  170. package/build/components/url-input/index.js.map +1 -1
  171. package/build/components/use-block-drop-zone/index.js +4 -6
  172. package/build/components/use-block-drop-zone/index.js.map +1 -1
  173. package/build/components/writing-flow/index.js +2 -1
  174. package/build/components/writing-flow/index.js.map +1 -1
  175. package/build/components/writing-flow/use-arrow-nav.js +4 -1
  176. package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
  177. package/build/components/writing-flow/use-event-redirect.js +66 -0
  178. package/build/components/writing-flow/use-event-redirect.js.map +1 -0
  179. package/build/components/writing-flow/use-input.js +31 -1
  180. package/build/components/writing-flow/use-input.js.map +1 -1
  181. package/build/components/writing-flow/use-select-all.js +14 -1
  182. package/build/components/writing-flow/use-select-all.js.map +1 -1
  183. package/build/components/writing-flow/use-selection-observer.js +20 -6
  184. package/build/components/writing-flow/use-selection-observer.js.map +1 -1
  185. package/build/components/writing-flow/use-tab-nav.js +4 -4
  186. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  187. package/build/components/writing-flow/utils.js +27 -0
  188. package/build/components/writing-flow/utils.js.map +1 -1
  189. package/build/hooks/block-bindings.js +32 -29
  190. package/build/hooks/block-bindings.js.map +1 -1
  191. package/build/hooks/content-lock-ui.js +8 -26
  192. package/build/hooks/content-lock-ui.js.map +1 -1
  193. package/build/hooks/duotone.js +0 -4
  194. package/build/hooks/duotone.js.map +1 -1
  195. package/build/hooks/layout.js +4 -1
  196. package/build/hooks/layout.js.map +1 -1
  197. package/build/hooks/spacing-visualizer.js +3 -3
  198. package/build/hooks/spacing-visualizer.js.map +1 -1
  199. package/build/hooks/style.js +1 -5
  200. package/build/hooks/style.js.map +1 -1
  201. package/build/hooks/use-bindings-attributes.js +19 -20
  202. package/build/hooks/use-bindings-attributes.js.map +1 -1
  203. package/build/hooks/use-zoom-out.js +7 -7
  204. package/build/hooks/use-zoom-out.js.map +1 -1
  205. package/build/layouts/constrained.js +41 -41
  206. package/build/layouts/constrained.js.map +1 -1
  207. package/build/layouts/flex.js +4 -1
  208. package/build/layouts/flex.js.map +1 -1
  209. package/build/layouts/utils.js +1 -7
  210. package/build/layouts/utils.js.map +1 -1
  211. package/build/private-apis.js +2 -1
  212. package/build/private-apis.js.map +1 -1
  213. package/build/store/actions.js +2 -7
  214. package/build/store/actions.js.map +1 -1
  215. package/build/store/private-actions.js +1 -0
  216. package/build/store/private-actions.js.map +1 -1
  217. package/build/store/private-keys.js +2 -1
  218. package/build/store/private-keys.js.map +1 -1
  219. package/build/store/private-selectors.js +13 -15
  220. package/build/store/private-selectors.js.map +1 -1
  221. package/build/store/reducer.js +1 -8
  222. package/build/store/reducer.js.map +1 -1
  223. package/build/store/selectors.js +19 -43
  224. package/build/store/selectors.js.map +1 -1
  225. package/build/store/utils.js +48 -0
  226. package/build/store/utils.js.map +1 -1
  227. package/build/utils/block-bindings.js +16 -11
  228. package/build/utils/block-bindings.js.map +1 -1
  229. package/build/utils/dom.js +101 -0
  230. package/build/utils/dom.js.map +1 -1
  231. package/build/utils/get-font-styles-and-weights.js +4 -4
  232. package/build/utils/get-font-styles-and-weights.js.map +1 -1
  233. package/build/utils/transform-styles/index.js +120 -16
  234. package/build/utils/transform-styles/index.js.map +1 -1
  235. package/build-module/components/block-alignment-matrix-control/index.js +1 -1
  236. package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
  237. package/build-module/components/block-breadcrumb/index.js +8 -2
  238. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  239. package/build-module/components/block-canvas/index.js +9 -1
  240. package/build-module/components/block-canvas/index.js.map +1 -1
  241. package/build-module/components/block-compare/block-view.js +4 -1
  242. package/build-module/components/block-compare/block-view.js.map +1 -1
  243. package/build-module/components/block-draggable/index.js +4 -4
  244. package/build-module/components/block-draggable/index.js.map +1 -1
  245. package/build-module/components/block-draggable/use-scroll-when-dragging.js +25 -25
  246. package/build-module/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
  247. package/build-module/components/block-edit/multiple-usage-warning.js +8 -2
  248. package/build-module/components/block-edit/multiple-usage-warning.js.map +1 -1
  249. package/build-module/components/block-inspector/index.js +27 -9
  250. package/build-module/components/block-inspector/index.js.map +1 -1
  251. package/build-module/components/block-list/block-invalid-warning.js +6 -3
  252. package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
  253. package/build-module/components/block-list/block.js +5 -1
  254. package/build-module/components/block-list/block.js.map +1 -1
  255. package/build-module/components/block-list/use-block-props/index.js +5 -1
  256. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  257. package/build-module/components/block-list/use-block-props/use-focus-first-element.js +1 -0
  258. package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  259. package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js +40 -0
  260. package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -0
  261. package/build-module/components/block-lock/toolbar.js +3 -3
  262. package/build-module/components/block-lock/toolbar.js.map +1 -1
  263. package/build-module/components/block-mover/button.js +4 -1
  264. package/build-module/components/block-mover/button.js.map +1 -1
  265. package/build-module/components/block-mover/index.js +4 -1
  266. package/build-module/components/block-mover/index.js.map +1 -1
  267. package/build-module/components/block-navigation/dropdown.js +4 -1
  268. package/build-module/components/block-navigation/dropdown.js.map +1 -1
  269. package/build-module/components/block-pattern-setup/index.js +1 -4
  270. package/build-module/components/block-pattern-setup/index.js.map +1 -1
  271. package/build-module/components/block-pattern-setup/setup-toolbar.js +23 -8
  272. package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
  273. package/build-module/components/block-patterns-list/index.js +11 -14
  274. package/build-module/components/block-patterns-list/index.js.map +1 -1
  275. package/build-module/components/block-patterns-paging/index.js +12 -3
  276. package/build-module/components/block-patterns-paging/index.js.map +1 -1
  277. package/build-module/components/block-popover/index.js +2 -15
  278. package/build-module/components/block-popover/index.js.map +1 -1
  279. package/build-module/components/block-quick-navigation/index.js +4 -1
  280. package/build-module/components/block-quick-navigation/index.js.map +1 -1
  281. package/build-module/components/block-settings-menu-controls/index.js +4 -0
  282. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  283. package/build-module/components/block-switcher/index.js +22 -17
  284. package/build-module/components/block-switcher/index.js.map +1 -1
  285. package/build-module/components/block-switcher/pattern-transformations-menu.js +1 -4
  286. package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  287. package/build-module/components/block-toolbar/index.js +12 -11
  288. package/build-module/components/block-toolbar/index.js.map +1 -1
  289. package/build-module/components/block-toolbar/shuffle.js +6 -2
  290. package/build-module/components/block-toolbar/shuffle.js.map +1 -1
  291. package/build-module/components/block-tools/block-selection-button.js +8 -2
  292. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  293. package/build-module/components/block-tools/block-toolbar-popover.js +10 -6
  294. package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -1
  295. package/build-module/components/block-tools/use-block-toolbar-popover-props.js +2 -1
  296. package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  297. package/build-module/components/block-tools/zoom-out-mode-inserters.js +4 -9
  298. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  299. package/build-module/components/block-tools/zoom-out-popover.js +3 -4
  300. package/build-module/components/block-tools/zoom-out-popover.js.map +1 -1
  301. package/build-module/components/block-tools/zoom-out-toolbar.js +15 -6
  302. package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
  303. package/build-module/components/block-variation-picker/index.js +4 -1
  304. package/build-module/components/block-variation-picker/index.js.map +1 -1
  305. package/build-module/components/block-variation-transforms/index.js +4 -1
  306. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  307. package/build-module/components/button-block-appender/index.js +15 -4
  308. package/build-module/components/button-block-appender/index.js.map +1 -1
  309. package/build-module/components/colors-gradients/dropdown.js +4 -1
  310. package/build-module/components/colors-gradients/dropdown.js.map +1 -1
  311. package/build-module/components/content-lock/index.js +2 -0
  312. package/build-module/components/content-lock/index.js.map +1 -0
  313. package/build-module/components/content-lock/modify-content-lock-menu-item.js +57 -0
  314. package/build-module/components/content-lock/modify-content-lock-menu-item.js.map +1 -0
  315. package/build-module/components/editor-styles/index.js +4 -3
  316. package/build-module/components/editor-styles/index.js.map +1 -1
  317. package/build-module/components/global-styles/background-panel.js +8 -12
  318. package/build-module/components/global-styles/background-panel.js.map +1 -1
  319. package/build-module/components/global-styles/color-panel.js +7 -4
  320. package/build-module/components/global-styles/color-panel.js.map +1 -1
  321. package/build-module/components/global-styles/color-panel.native.js +2 -2
  322. package/build-module/components/global-styles/color-panel.native.js.map +1 -1
  323. package/build-module/components/global-styles/dimensions-panel.js +36 -39
  324. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  325. package/build-module/components/global-styles/filters-panel.js +4 -1
  326. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  327. package/build-module/components/global-styles/shadow-panel-components.js +13 -7
  328. package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
  329. package/build-module/components/global-styles/typography-utils.js +17 -6
  330. package/build-module/components/global-styles/typography-utils.js.map +1 -1
  331. package/build-module/components/global-styles/utils.js +4 -6
  332. package/build-module/components/global-styles/utils.js.map +1 -1
  333. package/build-module/components/grid/grid-item-movers.js +3 -3
  334. package/build-module/components/grid/grid-item-movers.js.map +1 -1
  335. package/build-module/components/iframe/index.js +5 -5
  336. package/build-module/components/iframe/index.js.map +1 -1
  337. package/build-module/components/inner-blocks/index.js +2 -4
  338. package/build-module/components/inner-blocks/index.js.map +1 -1
  339. package/build-module/components/inner-blocks/use-inner-block-template-sync.js +3 -3
  340. package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  341. package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +4 -1
  342. package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
  343. package/build-module/components/inserter/block-patterns-tab/index.js +4 -1
  344. package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
  345. package/build-module/components/inserter/library.js +2 -4
  346. package/build-module/components/inserter/library.js.map +1 -1
  347. package/build-module/components/inserter/media-tab/hooks.js +3 -3
  348. package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
  349. package/build-module/components/inserter/media-tab/media-list.js +1 -4
  350. package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
  351. package/build-module/components/inserter/media-tab/media-preview.js +8 -2
  352. package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
  353. package/build-module/components/inserter/media-tab/media-tab.js +4 -1
  354. package/build-module/components/inserter/media-tab/media-tab.js.map +1 -1
  355. package/build-module/components/inserter/menu.js +7 -24
  356. package/build-module/components/inserter/menu.js.map +1 -1
  357. package/build-module/components/inserter/quick-inserter.js +4 -1
  358. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  359. package/build-module/components/inserter-list-item/index.js +4 -4
  360. package/build-module/components/inserter-list-item/index.js.map +1 -1
  361. package/build-module/components/inserter-listbox/index.js +3 -7
  362. package/build-module/components/inserter-listbox/index.js.map +1 -1
  363. package/build-module/components/inserter-listbox/item.js +4 -1
  364. package/build-module/components/inserter-listbox/item.js.map +1 -1
  365. package/build-module/components/inspector-controls/groups.js +2 -0
  366. package/build-module/components/inspector-controls/groups.js.map +1 -1
  367. package/build-module/components/inspector-controls-tabs/index.js +4 -1
  368. package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
  369. package/build-module/components/inspector-controls-tabs/settings-tab.js +3 -1
  370. package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -1
  371. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +2 -1
  372. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  373. package/build-module/components/inspector-popover-header/index.js +8 -2
  374. package/build-module/components/inspector-popover-header/index.js.map +1 -1
  375. package/build-module/components/letter-spacing-control/index.js +7 -4
  376. package/build-module/components/letter-spacing-control/index.js.map +1 -1
  377. package/build-module/components/link-control/index.js +19 -10
  378. package/build-module/components/link-control/index.js.map +1 -1
  379. package/build-module/components/link-control/settings-drawer.js +4 -1
  380. package/build-module/components/link-control/settings-drawer.js.map +1 -1
  381. package/build-module/components/list-view/block-select-button.js +4 -1
  382. package/build-module/components/list-view/block-select-button.js.map +1 -1
  383. package/build-module/components/media-placeholder/index.js +28 -7
  384. package/build-module/components/media-placeholder/index.js.map +1 -1
  385. package/build-module/components/media-replace-flow/index.js +8 -1
  386. package/build-module/components/media-replace-flow/index.js.map +1 -1
  387. package/build-module/components/provider/use-block-sync.js +19 -19
  388. package/build-module/components/provider/use-block-sync.js.map +1 -1
  389. package/build-module/components/rich-text/event-listeners/paste-handler.js +12 -1
  390. package/build-module/components/rich-text/event-listeners/paste-handler.js.map +1 -1
  391. package/build-module/components/rich-text/index.js +39 -31
  392. package/build-module/components/rich-text/index.js.map +1 -1
  393. package/build-module/components/rich-text/use-mark-persistent.js +5 -5
  394. package/build-module/components/rich-text/use-mark-persistent.js.map +1 -1
  395. package/build-module/components/skip-to-selected-block/index.js +4 -1
  396. package/build-module/components/skip-to-selected-block/index.js.map +1 -1
  397. package/build-module/components/tool-selector/index.js +4 -1
  398. package/build-module/components/tool-selector/index.js.map +1 -1
  399. package/build-module/components/url-input/button.js +12 -3
  400. package/build-module/components/url-input/button.js.map +1 -1
  401. package/build-module/components/url-input/index.js +4 -1
  402. package/build-module/components/url-input/index.js.map +1 -1
  403. package/build-module/components/use-block-drop-zone/index.js +4 -6
  404. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  405. package/build-module/components/writing-flow/index.js +2 -1
  406. package/build-module/components/writing-flow/index.js.map +1 -1
  407. package/build-module/components/writing-flow/use-arrow-nav.js +4 -1
  408. package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
  409. package/build-module/components/writing-flow/use-event-redirect.js +60 -0
  410. package/build-module/components/writing-flow/use-event-redirect.js.map +1 -0
  411. package/build-module/components/writing-flow/use-input.js +31 -1
  412. package/build-module/components/writing-flow/use-input.js.map +1 -1
  413. package/build-module/components/writing-flow/use-select-all.js +14 -1
  414. package/build-module/components/writing-flow/use-select-all.js.map +1 -1
  415. package/build-module/components/writing-flow/use-selection-observer.js +16 -2
  416. package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
  417. package/build-module/components/writing-flow/use-tab-nav.js +4 -4
  418. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  419. package/build-module/components/writing-flow/utils.js +26 -0
  420. package/build-module/components/writing-flow/utils.js.map +1 -1
  421. package/build-module/hooks/block-bindings.js +34 -31
  422. package/build-module/hooks/block-bindings.js.map +1 -1
  423. package/build-module/hooks/content-lock-ui.js +10 -30
  424. package/build-module/hooks/content-lock-ui.js.map +1 -1
  425. package/build-module/hooks/duotone.js +0 -4
  426. package/build-module/hooks/duotone.js.map +1 -1
  427. package/build-module/hooks/layout.js +4 -1
  428. package/build-module/hooks/layout.js.map +1 -1
  429. package/build-module/hooks/spacing-visualizer.js +3 -3
  430. package/build-module/hooks/spacing-visualizer.js.map +1 -1
  431. package/build-module/hooks/style.js +1 -5
  432. package/build-module/hooks/style.js.map +1 -1
  433. package/build-module/hooks/use-bindings-attributes.js +19 -20
  434. package/build-module/hooks/use-bindings-attributes.js.map +1 -1
  435. package/build-module/hooks/use-zoom-out.js +7 -7
  436. package/build-module/hooks/use-zoom-out.js.map +1 -1
  437. package/build-module/layouts/constrained.js +43 -43
  438. package/build-module/layouts/constrained.js.map +1 -1
  439. package/build-module/layouts/flex.js +4 -1
  440. package/build-module/layouts/flex.js.map +1 -1
  441. package/build-module/layouts/utils.js +1 -7
  442. package/build-module/layouts/utils.js.map +1 -1
  443. package/build-module/private-apis.js +3 -2
  444. package/build-module/private-apis.js.map +1 -1
  445. package/build-module/store/actions.js +2 -7
  446. package/build-module/store/actions.js.map +1 -1
  447. package/build-module/store/private-actions.js +1 -0
  448. package/build-module/store/private-actions.js.map +1 -1
  449. package/build-module/store/private-keys.js +1 -0
  450. package/build-module/store/private-keys.js.map +1 -1
  451. package/build-module/store/private-selectors.js +12 -15
  452. package/build-module/store/private-selectors.js.map +1 -1
  453. package/build-module/store/reducer.js +1 -7
  454. package/build-module/store/reducer.js.map +1 -1
  455. package/build-module/store/selectors.js +22 -46
  456. package/build-module/store/selectors.js.map +1 -1
  457. package/build-module/store/utils.js +46 -0
  458. package/build-module/store/utils.js.map +1 -1
  459. package/build-module/utils/block-bindings.js +17 -12
  460. package/build-module/utils/block-bindings.js.map +1 -1
  461. package/build-module/utils/dom.js +99 -0
  462. package/build-module/utils/dom.js.map +1 -1
  463. package/build-module/utils/get-font-styles-and-weights.js +4 -4
  464. package/build-module/utils/get-font-styles-and-weights.js.map +1 -1
  465. package/build-module/utils/transform-styles/index.js +120 -16
  466. package/build-module/utils/transform-styles/index.js.map +1 -1
  467. package/build-style/content-rtl.css +2 -11
  468. package/build-style/content.css +2 -11
  469. package/build-style/style-rtl.css +17 -38
  470. package/build-style/style.css +17 -38
  471. package/build-types/utils/dom.d.ts +25 -0
  472. package/build-types/utils/dom.d.ts.map +1 -1
  473. package/package.json +34 -32
  474. package/src/components/block-alignment-matrix-control/index.js +1 -1
  475. package/src/components/block-breadcrumb/index.js +4 -0
  476. package/src/components/block-breadcrumb/style.scss +1 -1
  477. package/src/components/block-canvas/index.js +9 -1
  478. package/src/components/block-compare/block-view.js +7 -1
  479. package/src/components/block-draggable/content.scss +1 -1
  480. package/src/components/block-draggable/index.js +4 -4
  481. package/src/components/block-draggable/style.scss +1 -1
  482. package/src/components/block-draggable/use-scroll-when-dragging.js +25 -25
  483. package/src/components/block-edit/multiple-usage-warning.js +4 -0
  484. package/src/components/block-inspector/index.js +22 -6
  485. package/src/components/block-list/block-invalid-warning.js +4 -2
  486. package/src/components/block-list/block.js +6 -2
  487. package/src/components/block-list/content.scss +2 -3
  488. package/src/components/block-list/use-block-props/index.js +3 -0
  489. package/src/components/block-list/use-block-props/use-focus-first-element.js +1 -0
  490. package/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js +44 -0
  491. package/src/components/block-lock/style.scss +1 -1
  492. package/src/components/block-lock/toolbar.js +3 -3
  493. package/src/components/block-mover/button.js +2 -0
  494. package/src/components/block-mover/index.js +2 -0
  495. package/src/components/block-mover/style.scss +1 -1
  496. package/src/components/block-navigation/dropdown.js +2 -0
  497. package/src/components/block-pattern-setup/index.js +3 -7
  498. package/src/components/block-pattern-setup/setup-toolbar.js +17 -4
  499. package/src/components/block-pattern-setup/style.scss +2 -2
  500. package/src/components/block-patterns-list/index.js +15 -13
  501. package/src/components/block-patterns-list/style.scss +2 -2
  502. package/src/components/block-patterns-paging/index.js +6 -0
  503. package/src/components/block-popover/index.js +7 -28
  504. package/src/components/block-popover/style.scss +1 -1
  505. package/src/components/block-quick-navigation/index.js +2 -0
  506. package/src/components/block-settings-menu-controls/index.js +7 -1
  507. package/src/components/block-switcher/index.js +26 -20
  508. package/src/components/block-switcher/pattern-transformations-menu.js +3 -7
  509. package/src/components/block-switcher/style.scss +5 -6
  510. package/src/components/block-toolbar/index.js +17 -8
  511. package/src/components/block-toolbar/shuffle.js +9 -7
  512. package/src/components/block-tools/block-selection-button.js +4 -0
  513. package/src/components/block-tools/block-toolbar-popover.js +10 -6
  514. package/src/components/block-tools/style.scss +3 -4
  515. package/src/components/block-tools/use-block-toolbar-popover-props.js +2 -1
  516. package/src/components/block-tools/zoom-out-mode-inserters.js +2 -5
  517. package/src/components/block-tools/zoom-out-popover.js +3 -7
  518. package/src/components/block-tools/zoom-out-toolbar.js +20 -6
  519. package/src/components/block-variation-picker/README.md +2 -2
  520. package/src/components/block-variation-picker/index.js +6 -1
  521. package/src/components/block-variation-transforms/index.js +2 -0
  522. package/src/components/block-variation-transforms/style.scss +1 -1
  523. package/src/components/button-block-appender/content.scss +0 -1
  524. package/src/components/button-block-appender/index.js +14 -3
  525. package/src/components/color-palette/test/control.js +15 -2
  526. package/src/components/colors-gradients/dropdown.js +5 -1
  527. package/src/components/colors-gradients/style.scss +4 -4
  528. package/src/components/content-lock/index.js +1 -0
  529. package/src/components/content-lock/modify-content-lock-menu-item.js +58 -0
  530. package/src/components/default-block-appender/content.scss +0 -1
  531. package/src/components/editor-styles/index.js +4 -3
  532. package/src/components/global-styles/background-panel.js +6 -14
  533. package/src/components/global-styles/color-panel.js +8 -4
  534. package/src/components/global-styles/color-panel.native.js +2 -2
  535. package/src/components/global-styles/dimensions-panel.js +40 -40
  536. package/src/components/global-styles/filters-panel.js +5 -1
  537. package/src/components/global-styles/shadow-panel-components.js +12 -8
  538. package/src/components/global-styles/style.scss +3 -4
  539. package/src/components/global-styles/test/typography-utils.js +96 -5
  540. package/src/components/global-styles/test/utils.js +10 -0
  541. package/src/components/global-styles/typography-utils.js +22 -6
  542. package/src/components/global-styles/utils.js +4 -6
  543. package/src/components/grid/grid-item-movers.js +3 -3
  544. package/src/components/grid/style.scss +1 -1
  545. package/src/components/iframe/index.js +5 -5
  546. package/src/components/inner-blocks/index.js +2 -2
  547. package/src/components/inner-blocks/use-inner-block-template-sync.js +3 -3
  548. package/src/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +2 -0
  549. package/src/components/inserter/block-patterns-tab/index.js +2 -0
  550. package/src/components/inserter/library.js +0 -2
  551. package/src/components/inserter/media-tab/hooks.js +3 -3
  552. package/src/components/inserter/media-tab/media-list.js +1 -4
  553. package/src/components/inserter/media-tab/media-preview.js +12 -2
  554. package/src/components/inserter/media-tab/media-tab.js +2 -0
  555. package/src/components/inserter/menu.js +15 -29
  556. package/src/components/inserter/quick-inserter.js +2 -0
  557. package/src/components/inserter/style.scss +6 -8
  558. package/src/components/inserter-list-item/index.js +4 -4
  559. package/src/components/inserter-list-item/style.scss +1 -3
  560. package/src/components/inserter-listbox/index.js +2 -8
  561. package/src/components/inserter-listbox/item.js +9 -1
  562. package/src/components/inspector-controls/groups.js +2 -0
  563. package/src/components/inspector-controls-tabs/index.js +2 -0
  564. package/src/components/inspector-controls-tabs/settings-tab.js +1 -0
  565. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +5 -2
  566. package/src/components/inspector-popover-header/index.js +4 -0
  567. package/src/components/letter-spacing-control/README.md +8 -1
  568. package/src/components/letter-spacing-control/index.js +7 -4
  569. package/src/components/link-control/index.js +17 -8
  570. package/src/components/link-control/settings-drawer.js +2 -0
  571. package/src/components/link-control/style.scss +1 -3
  572. package/src/components/list-view/block-select-button.js +2 -0
  573. package/src/components/list-view/style.scss +14 -16
  574. package/src/components/media-placeholder/index.js +14 -0
  575. package/src/components/media-replace-flow/index.js +12 -1
  576. package/src/components/provider/use-block-sync.js +20 -20
  577. package/src/components/responsive-block-control/README.md +3 -27
  578. package/src/components/rich-text/content.scss +1 -1
  579. package/src/components/rich-text/event-listeners/paste-handler.js +6 -1
  580. package/src/components/rich-text/index.js +54 -41
  581. package/src/components/rich-text/style.scss +1 -1
  582. package/src/components/rich-text/use-mark-persistent.js +5 -5
  583. package/src/components/skip-to-selected-block/index.js +2 -0
  584. package/src/components/spacing-sizes-control/style.scss +1 -0
  585. package/src/components/tool-selector/index.js +2 -0
  586. package/src/components/url-input/button.js +6 -0
  587. package/src/components/url-input/index.js +2 -0
  588. package/src/components/url-popover/stories/index.story.js +7 -1
  589. package/src/components/use-block-drop-zone/index.js +4 -4
  590. package/src/components/warning/content.scss +3 -10
  591. package/src/components/writing-flow/index.js +2 -0
  592. package/src/components/writing-flow/use-arrow-nav.js +9 -2
  593. package/src/components/writing-flow/use-event-redirect.js +72 -0
  594. package/src/components/writing-flow/use-input.js +36 -1
  595. package/src/components/writing-flow/use-select-all.js +18 -1
  596. package/src/components/writing-flow/use-selection-observer.js +23 -3
  597. package/src/components/writing-flow/use-tab-nav.js +4 -4
  598. package/src/components/writing-flow/utils.js +30 -0
  599. package/src/hooks/block-bindings.js +42 -43
  600. package/src/hooks/block-bindings.scss +1 -9
  601. package/src/hooks/content-lock-ui.js +11 -36
  602. package/src/hooks/duotone.js +0 -4
  603. package/src/hooks/layout.js +2 -0
  604. package/src/hooks/layout.scss +3 -11
  605. package/src/hooks/spacing-visualizer.js +3 -3
  606. package/src/hooks/style.js +1 -4
  607. package/src/hooks/use-bindings-attributes.js +23 -24
  608. package/src/hooks/use-zoom-out.js +7 -7
  609. package/src/layouts/constrained.js +50 -47
  610. package/src/layouts/flex.js +2 -0
  611. package/src/layouts/test/grid.js +2 -2
  612. package/src/layouts/test/utils.js +6 -8
  613. package/src/layouts/utils.js +1 -9
  614. package/src/private-apis.js +2 -0
  615. package/src/store/actions.js +4 -6
  616. package/src/store/private-actions.js +1 -0
  617. package/src/store/private-keys.js +1 -0
  618. package/src/store/private-selectors.js +12 -11
  619. package/src/store/reducer.js +0 -5
  620. package/src/store/selectors.js +32 -51
  621. package/src/store/utils.js +50 -0
  622. package/src/utils/block-bindings.js +15 -16
  623. package/src/utils/dom.js +117 -0
  624. package/src/utils/get-font-styles-and-weights.js +12 -4
  625. package/src/utils/test/get-font-styles-and-weights.js +148 -0
  626. package/src/utils/test/transform-styles.js +259 -50
  627. package/src/utils/transform-styles/index.js +132 -21
  628. package/tsconfig.json +1 -0
  629. package/tsconfig.tsbuildinfo +1 -1
  630. package/src/utils/test/__snapshots__/transform-styles.js.snap +0 -109
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_data","_element","_compose","_blocks","_components","_blockMover","_blockParentSelector","_blockSwitcher","_blockControls","_blockToolbarLastItem","_blockSettingsMenu","_blockLock","_convertToGroupButtons","_blockEditVisuallyButton","_utils","_store","_blockNameContext","_navigableToolbar","_shuffle","_useHasBlockToolbar","_jsxRuntime","PrivateBlockToolbar","hideDragHandle","focusOnMount","__experimentalInitialIndex","__experimentalOnIndexChange","variant","blockClientId","blockClientIds","isDefaultEditingMode","blockType","toolbarKey","shouldShowVisualToolbar","showParentSelector","isUsingBindings","useSelect","select","getBlockName","getBlockMode","getBlockParents","getSelectedBlockClientIds","isBlockValid","getBlockRootClientId","getBlockEditingMode","getBlockAttributes","blockEditorStore","selectedBlockClientIds","selectedBlockClientId","blockRootClientId","parents","firstParentClientId","length","parentBlockName","parentBlockType","getBlockType","_isDefaultEditingMode","_blockName","isValid","every","id","isVisual","_isUsingBindings","clientId","metadata","bindings","rootClientId","hasBlockSupport","toolbarWrapperRef","useRef","nodeRef","showHoveredOrFocusedGestures","useShowHoveredOrFocusedGestures","ref","isLargeViewport","useViewportMatch","hasBlockToolbar","useHasBlockToolbar","isMultiToolbar","isSynced","isReusableBlock","isTemplatePart","classes","clsx","innerClasses","jsx","default","focusEditorOnEscape","className","__","undefined","children","jsxs","ToolbarGroup","clientIds","disabled","Fragment","BlockLockToolbar","BlockGroupToolbar","Slot","group","Provider","value","name","BlockToolbar"],"sources":["@wordpress/block-editor/src/components/block-toolbar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tgetBlockType,\n\thasBlockSupport,\n\tisReusableBlock,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { ToolbarGroup } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockMover from '../block-mover';\nimport BlockParentSelector from '../block-parent-selector';\nimport BlockSwitcher from '../block-switcher';\nimport BlockControls from '../block-controls';\nimport __unstableBlockToolbarLastItem from './block-toolbar-last-item';\nimport BlockSettingsMenu from '../block-settings-menu';\nimport { BlockLockToolbar } from '../block-lock';\nimport { BlockGroupToolbar } from '../convert-to-group-buttons';\nimport BlockEditVisuallyButton from '../block-edit-visually-button';\nimport { useShowHoveredOrFocusedGestures } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport __unstableBlockNameContext from './block-name-context';\nimport NavigableToolbar from '../navigable-toolbar';\nimport Shuffle from './shuffle';\nimport { useHasBlockToolbar } from './use-has-block-toolbar';\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {boolean} props.focusOnMount Focus the toolbar when mounted.\n * @param {number} props.__experimentalInitialIndex The initial index of the toolbar item to focus.\n * @param {Function} props.__experimentalOnIndexChange Callback function to be called when the index of the focused toolbar item changes.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport function PrivateBlockToolbar( {\n\thideDragHandle,\n\tfocusOnMount,\n\t__experimentalInitialIndex,\n\t__experimentalOnIndexChange,\n\tvariant = 'unstyled',\n} ) {\n\tconst {\n\t\tblockClientId,\n\t\tblockClientIds,\n\t\tisDefaultEditingMode,\n\t\tblockType,\n\t\ttoolbarKey,\n\t\tshouldShowVisualToolbar,\n\t\tshowParentSelector,\n\t\tisUsingBindings,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockName,\n\t\t\tgetBlockMode,\n\t\t\tgetBlockParents,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tisBlockValid,\n\t\t\tgetBlockRootClientId,\n\t\t\tgetBlockEditingMode,\n\t\t\tgetBlockAttributes,\n\t\t} = select( blockEditorStore );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst selectedBlockClientId = selectedBlockClientIds[ 0 ];\n\t\tconst blockRootClientId = getBlockRootClientId( selectedBlockClientId );\n\t\tconst parents = getBlockParents( selectedBlockClientId );\n\t\tconst firstParentClientId = parents[ parents.length - 1 ];\n\t\tconst parentBlockName = getBlockName( firstParentClientId );\n\t\tconst parentBlockType = getBlockType( parentBlockName );\n\t\tconst _isDefaultEditingMode =\n\t\t\tgetBlockEditingMode( selectedBlockClientId ) === 'default';\n\t\tconst _blockName = getBlockName( selectedBlockClientId );\n\t\tconst isValid = selectedBlockClientIds.every( ( id ) =>\n\t\t\tisBlockValid( id )\n\t\t);\n\t\tconst isVisual = selectedBlockClientIds.every(\n\t\t\t( id ) => getBlockMode( id ) === 'visual'\n\t\t);\n\t\tconst _isUsingBindings = selectedBlockClientIds.every(\n\t\t\t( clientId ) =>\n\t\t\t\t!! getBlockAttributes( clientId )?.metadata?.bindings\n\t\t);\n\t\treturn {\n\t\t\tblockClientId: selectedBlockClientId,\n\t\t\tblockClientIds: selectedBlockClientIds,\n\t\t\tisDefaultEditingMode: _isDefaultEditingMode,\n\t\t\tblockType: selectedBlockClientId && getBlockType( _blockName ),\n\t\t\tshouldShowVisualToolbar: isValid && isVisual,\n\t\t\trootClientId: blockRootClientId,\n\t\t\ttoolbarKey: `${ selectedBlockClientId }${ firstParentClientId }`,\n\t\t\tshowParentSelector:\n\t\t\t\tparentBlockType &&\n\t\t\t\tgetBlockEditingMode( firstParentClientId ) === 'default' &&\n\t\t\t\thasBlockSupport(\n\t\t\t\t\tparentBlockType,\n\t\t\t\t\t'__experimentalParentSelector',\n\t\t\t\t\ttrue\n\t\t\t\t) &&\n\t\t\t\tselectedBlockClientIds.length === 1 &&\n\t\t\t\t_isDefaultEditingMode,\n\t\t\tisUsingBindings: _isUsingBindings,\n\t\t};\n\t}, [] );\n\n\tconst toolbarWrapperRef = useRef( null );\n\n\t// Handles highlighting the current block outline on hover or focus of the\n\t// block type toolbar area.\n\tconst nodeRef = useRef();\n\tconst showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures( {\n\t\tref: nodeRef,\n\t} );\n\n\tconst isLargeViewport = ! useViewportMatch( 'medium', '<' );\n\n\tconst hasBlockToolbar = useHasBlockToolbar();\n\tif ( ! hasBlockToolbar ) {\n\t\treturn null;\n\t}\n\n\tconst isMultiToolbar = blockClientIds.length > 1;\n\tconst isSynced =\n\t\tisReusableBlock( blockType ) || isTemplatePart( blockType );\n\n\t// Shifts the toolbar to make room for the parent block selector.\n\tconst classes = clsx( 'block-editor-block-contextual-toolbar', {\n\t\t'has-parent': showParentSelector,\n\t} );\n\n\tconst innerClasses = clsx( 'block-editor-block-toolbar', {\n\t\t'is-synced': isSynced,\n\t\t'is-connected': isUsingBindings,\n\t} );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tfocusEditorOnEscape\n\t\t\tclassName={ classes }\n\t\t\t/* translators: accessibility text for the block toolbar */\n\t\t\taria-label={ __( 'Block tools' ) }\n\t\t\t// The variant is applied as \"toolbar\" when undefined, which is the black border style of the dropdown from the toolbar popover.\n\t\t\tvariant={ variant === 'toolbar' ? undefined : variant }\n\t\t\tfocusOnMount={ focusOnMount }\n\t\t\t__experimentalInitialIndex={ __experimentalInitialIndex }\n\t\t\t__experimentalOnIndexChange={ __experimentalOnIndexChange }\n\t\t\t// Resets the index whenever the active block changes so\n\t\t\t// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\t\tkey={ toolbarKey }\n\t\t>\n\t\t\t<div ref={ toolbarWrapperRef } className={ innerClasses }>\n\t\t\t\t{ ! isMultiToolbar &&\n\t\t\t\t\tisLargeViewport &&\n\t\t\t\t\tisDefaultEditingMode && <BlockParentSelector /> }\n\t\t\t\t{ ( shouldShowVisualToolbar || isMultiToolbar ) &&\n\t\t\t\t\t( isDefaultEditingMode || isSynced ) && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tref={ nodeRef }\n\t\t\t\t\t\t\t{ ...showHoveredOrFocusedGestures }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToolbarGroup className=\"block-editor-block-toolbar__block-controls\">\n\t\t\t\t\t\t\t\t<BlockSwitcher\n\t\t\t\t\t\t\t\t\tclientIds={ blockClientIds }\n\t\t\t\t\t\t\t\t\tdisabled={ ! isDefaultEditingMode }\n\t\t\t\t\t\t\t\t\tisUsingBindings={ isUsingBindings }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ isDefaultEditingMode && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t{ ! isMultiToolbar && (\n\t\t\t\t\t\t\t\t\t\t\t<BlockLockToolbar\n\t\t\t\t\t\t\t\t\t\t\t\tclientId={ blockClientId }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t<BlockMover\n\t\t\t\t\t\t\t\t\t\t\tclientIds={ blockClientIds }\n\t\t\t\t\t\t\t\t\t\t\thideDragHandle={ hideDragHandle }\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) }\n\t\t\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t<Shuffle clientId={ blockClientId } />\n\t\t\t\t{ shouldShowVisualToolbar && isMultiToolbar && (\n\t\t\t\t\t<BlockGroupToolbar />\n\t\t\t\t) }\n\t\t\t\t{ shouldShowVisualToolbar && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"parent\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"block\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot className=\"block-editor-block-toolbar__slot\" />\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"inline\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"other\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<__unstableBlockNameContext.Provider\n\t\t\t\t\t\t\tvalue={ blockType?.name }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<__unstableBlockToolbarLastItem.Slot />\n\t\t\t\t\t\t</__unstableBlockNameContext.Provider>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<BlockEditVisuallyButton clientIds={ blockClientIds } />\n\t\t\t\t{ isDefaultEditingMode && (\n\t\t\t\t\t<BlockSettingsMenu clientIds={ blockClientIds } />\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport default function BlockToolbar( { hideDragHandle, variant } ) {\n\treturn (\n\t\t<PrivateBlockToolbar\n\t\t\thideDragHandle={ hideDragHandle }\n\t\t\tvariant={ variant }\n\t\t\tfocusOnMount={ undefined }\n\t\t\t__experimentalInitialIndex={ undefined }\n\t\t\t__experimentalOnIndexChange={ undefined }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAMA,IAAAM,WAAA,GAAAN,OAAA;AAKA,IAAAO,WAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,oBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,cAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,cAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,qBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,kBAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,UAAA,GAAAb,OAAA;AACA,IAAAc,sBAAA,GAAAd,OAAA;AACA,IAAAe,wBAAA,GAAAhB,sBAAA,CAAAC,OAAA;AACA,IAAAgB,MAAA,GAAAhB,OAAA;AACA,IAAAiB,MAAA,GAAAjB,OAAA;AACA,IAAAkB,iBAAA,GAAAnB,sBAAA,CAAAC,OAAA;AACA,IAAAmB,iBAAA,GAAApB,sBAAA,CAAAC,OAAA;AACA,IAA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,CACzC,CAAC;AAEJ","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_data","_element","_compose","_blocks","_components","_blockMover","_blockParentSelector","_blockSwitcher","_blockControls","_blockToolbarLastItem","_blockSettingsMenu","_blockLock","_convertToGroupButtons","_blockEditVisuallyButton","_utils","_store","_blockNameContext","_navigableToolbar","_useHasBlockToolbar","_jsxRuntime","PrivateBlockToolbar","hideDragHandle","focusOnMount","__experimentalInitialIndex","__experimentalOnIndexChange","variant","blockClientId","blockClientIds","isContentOnlyEditingMode","isDefaultEditingMode","blockType","toolbarKey","shouldShowVisualToolbar","showParentSelector","isUsingBindings","hasParentPattern","useSelect","select","getBlockName","getBlockMode","getBlockParents","getSelectedBlockClientIds","isBlockValid","getBlockEditingMode","getBlockAttributes","getBlockParentsByBlockName","blockEditorStore","selectedBlockClientIds","selectedBlockClientId","parents","firstParentClientId","length","parentBlockName","parentBlockType","getBlockType","editingMode","_isDefaultEditingMode","_blockName","isValid","every","id","isVisual","_isUsingBindings","clientId","metadata","bindings","_hasParentPattern","hasBlockSupport","toolbarWrapperRef","useRef","nodeRef","showHoveredOrFocusedGestures","useShowHoveredOrFocusedGestures","ref","isLargeViewport","useViewportMatch","hasBlockToolbar","useHasBlockToolbar","isMultiToolbar","isSynced","isReusableBlock","isTemplatePart","classes","clsx","innerClasses","jsx","default","focusEditorOnEscape","className","__","undefined","children","jsxs","ToolbarGroup","clientIds","disabled","Fragment","BlockLockToolbar","BlockGroupToolbar","Slot","group","Provider","value","name","BlockToolbar"],"sources":["@wordpress/block-editor/src/components/block-toolbar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tgetBlockType,\n\thasBlockSupport,\n\tisReusableBlock,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { ToolbarGroup } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockMover from '../block-mover';\nimport BlockParentSelector from '../block-parent-selector';\nimport BlockSwitcher from '../block-switcher';\nimport BlockControls from '../block-controls';\nimport __unstableBlockToolbarLastItem from './block-toolbar-last-item';\nimport BlockSettingsMenu from '../block-settings-menu';\nimport { BlockLockToolbar } from '../block-lock';\nimport { BlockGroupToolbar } from '../convert-to-group-buttons';\nimport BlockEditVisuallyButton from '../block-edit-visually-button';\nimport { useShowHoveredOrFocusedGestures } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport __unstableBlockNameContext from './block-name-context';\nimport NavigableToolbar from '../navigable-toolbar';\nimport { useHasBlockToolbar } from './use-has-block-toolbar';\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {boolean} props.focusOnMount Focus the toolbar when mounted.\n * @param {number} props.__experimentalInitialIndex The initial index of the toolbar item to focus.\n * @param {Function} props.__experimentalOnIndexChange Callback function to be called when the index of the focused toolbar item changes.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport function PrivateBlockToolbar( {\n\thideDragHandle,\n\tfocusOnMount,\n\t__experimentalInitialIndex,\n\t__experimentalOnIndexChange,\n\tvariant = 'unstyled',\n} ) {\n\tconst {\n\t\tblockClientId,\n\t\tblockClientIds,\n\t\tisContentOnlyEditingMode,\n\t\tisDefaultEditingMode,\n\t\tblockType,\n\t\ttoolbarKey,\n\t\tshouldShowVisualToolbar,\n\t\tshowParentSelector,\n\t\tisUsingBindings,\n\t\thasParentPattern,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockName,\n\t\t\tgetBlockMode,\n\t\t\tgetBlockParents,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tisBlockValid,\n\t\t\tgetBlockEditingMode,\n\t\t\tgetBlockAttributes,\n\t\t\tgetBlockParentsByBlockName,\n\t\t} = select( blockEditorStore );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst selectedBlockClientId = selectedBlockClientIds[ 0 ];\n\t\tconst parents = getBlockParents( selectedBlockClientId );\n\t\tconst firstParentClientId = parents[ parents.length - 1 ];\n\t\tconst parentBlockName = getBlockName( firstParentClientId );\n\t\tconst parentBlockType = getBlockType( parentBlockName );\n\t\tconst editingMode = getBlockEditingMode( selectedBlockClientId );\n\t\tconst _isDefaultEditingMode = editingMode === 'default';\n\t\tconst _blockName = getBlockName( selectedBlockClientId );\n\t\tconst isValid = selectedBlockClientIds.every( ( id ) =>\n\t\t\tisBlockValid( id )\n\t\t);\n\t\tconst isVisual = selectedBlockClientIds.every(\n\t\t\t( id ) => getBlockMode( id ) === 'visual'\n\t\t);\n\t\tconst _isUsingBindings = selectedBlockClientIds.every(\n\t\t\t( clientId ) =>\n\t\t\t\t!! getBlockAttributes( clientId )?.metadata?.bindings\n\t\t);\n\n\t\tconst _hasParentPattern = selectedBlockClientIds.every(\n\t\t\t( clientId ) =>\n\t\t\t\tgetBlockParentsByBlockName( clientId, 'core/block', true )\n\t\t\t\t\t.length > 0\n\t\t);\n\n\t\treturn {\n\t\t\tblockClientId: selectedBlockClientId,\n\t\t\tblockClientIds: selectedBlockClientIds,\n\t\t\tisContentOnlyEditingMode: editingMode === 'contentOnly',\n\t\t\tisDefaultEditingMode: _isDefaultEditingMode,\n\t\t\tblockType: selectedBlockClientId && getBlockType( _blockName ),\n\t\t\tshouldShowVisualToolbar: isValid && isVisual,\n\t\t\ttoolbarKey: `${ selectedBlockClientId }${ firstParentClientId }`,\n\t\t\tshowParentSelector:\n\t\t\t\tparentBlockType &&\n\t\t\t\tgetBlockEditingMode( firstParentClientId ) === 'default' &&\n\t\t\t\thasBlockSupport(\n\t\t\t\t\tparentBlockType,\n\t\t\t\t\t'__experimentalParentSelector',\n\t\t\t\t\ttrue\n\t\t\t\t) &&\n\t\t\t\tselectedBlockClientIds.length === 1 &&\n\t\t\t\t_isDefaultEditingMode,\n\t\t\tisUsingBindings: _isUsingBindings,\n\t\t\thasParentPattern: _hasParentPattern,\n\t\t};\n\t}, [] );\n\n\tconst toolbarWrapperRef = useRef( null );\n\n\t// Handles highlighting the current block outline on hover or focus of the\n\t// block type toolbar area.\n\tconst nodeRef = useRef();\n\tconst showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures( {\n\t\tref: nodeRef,\n\t} );\n\n\tconst isLargeViewport = ! useViewportMatch( 'medium', '<' );\n\n\tconst hasBlockToolbar = useHasBlockToolbar();\n\tif ( ! hasBlockToolbar ) {\n\t\treturn null;\n\t}\n\n\tconst isMultiToolbar = blockClientIds.length > 1;\n\tconst isSynced =\n\t\tisReusableBlock( blockType ) || isTemplatePart( blockType );\n\n\t// Shifts the toolbar to make room for the parent block selector.\n\tconst classes = clsx( 'block-editor-block-contextual-toolbar', {\n\t\t'has-parent': showParentSelector,\n\t} );\n\n\tconst innerClasses = clsx( 'block-editor-block-toolbar', {\n\t\t'is-synced': isSynced,\n\t\t'is-connected': isUsingBindings,\n\t} );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tfocusEditorOnEscape\n\t\t\tclassName={ classes }\n\t\t\t/* translators: accessibility text for the block toolbar */\n\t\t\taria-label={ __( 'Block tools' ) }\n\t\t\t// The variant is applied as \"toolbar\" when undefined, which is the black border style of the dropdown from the toolbar popover.\n\t\t\tvariant={ variant === 'toolbar' ? undefined : variant }\n\t\t\tfocusOnMount={ focusOnMount }\n\t\t\t__experimentalInitialIndex={ __experimentalInitialIndex }\n\t\t\t__experimentalOnIndexChange={ __experimentalOnIndexChange }\n\t\t\t// Resets the index whenever the active block changes so\n\t\t\t// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\t\tkey={ toolbarKey }\n\t\t>\n\t\t\t<div ref={ toolbarWrapperRef } className={ innerClasses }>\n\t\t\t\t{ ! isMultiToolbar &&\n\t\t\t\t\tisLargeViewport &&\n\t\t\t\t\tisDefaultEditingMode && <BlockParentSelector /> }\n\t\t\t\t{ ( shouldShowVisualToolbar || isMultiToolbar ) &&\n\t\t\t\t\t( isDefaultEditingMode ||\n\t\t\t\t\t\t( isContentOnlyEditingMode && ! hasParentPattern ) ||\n\t\t\t\t\t\tisSynced ) && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tref={ nodeRef }\n\t\t\t\t\t\t\t{ ...showHoveredOrFocusedGestures }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToolbarGroup className=\"block-editor-block-toolbar__block-controls\">\n\t\t\t\t\t\t\t\t<BlockSwitcher\n\t\t\t\t\t\t\t\t\tclientIds={ blockClientIds }\n\t\t\t\t\t\t\t\t\tdisabled={ ! isDefaultEditingMode }\n\t\t\t\t\t\t\t\t\tisUsingBindings={ isUsingBindings }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ isDefaultEditingMode && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t{ ! isMultiToolbar && (\n\t\t\t\t\t\t\t\t\t\t\t<BlockLockToolbar\n\t\t\t\t\t\t\t\t\t\t\t\tclientId={ blockClientId }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t<BlockMover\n\t\t\t\t\t\t\t\t\t\t\tclientIds={ blockClientIds }\n\t\t\t\t\t\t\t\t\t\t\thideDragHandle={ hideDragHandle }\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) }\n\t\t\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t{ shouldShowVisualToolbar && isMultiToolbar && (\n\t\t\t\t\t<BlockGroupToolbar />\n\t\t\t\t) }\n\t\t\t\t{ shouldShowVisualToolbar && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"parent\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"block\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot className=\"block-editor-block-toolbar__slot\" />\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"inline\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"other\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<__unstableBlockNameContext.Provider\n\t\t\t\t\t\t\tvalue={ blockType?.name }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<__unstableBlockToolbarLastItem.Slot />\n\t\t\t\t\t\t</__unstableBlockNameContext.Provider>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<BlockEditVisuallyButton clientIds={ blockClientIds } />\n\t\t\t\t{ isDefaultEditingMode && (\n\t\t\t\t\t<BlockSettingsMenu clientIds={ blockClientIds } />\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport default function BlockToolbar( { hideDragHandle, variant } ) {\n\treturn (\n\t\t<PrivateBlockToolbar\n\t\t\thideDragHandle={ hideDragHandle }\n\t\t\tvariant={ variant }\n\t\t\tfocusOnMount={ undefined }\n\t\t\t__experimentalInitialIndex={ undefined }\n\t\t\t__experimentalOnIndexChange={ undefined }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAMA,IAAAM,WAAA,GAAAN,OAAA;AAKA,IAAAO,WAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,oBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,cAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,cAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,qBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,kBAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,UAAA,GAAAb,OAAA;AACA,IAAAc,sBAAA,GAAAd,OAAA;AACA,IAAAe,wBAAA,GAAAhB,sBAAA,CAAAC,OAAA;AACA,IAAAgB,MAAA,GAAAhB,OAAA;AACA,IAAAiB,MAAA,GAAAjB,OAAA;AACA,IAAAkB,iBAAA,GAAAnB,sBAAA,CAAAC,OAAA;AACA,IAAAmB,iBAAA,GAAApB,sBAAA,CAAAC,OAAA;AACA,IAAAoB,mBAAA,GAAApB,OAAA;AAA6D,IAAAqB,WAAA,GAAArB,OAAA;AApC7D;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASsB,mBAAmB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AAC,eACnE,IAAArE,WAAA,CAAAkE,GAAA,EAAC7E,cAAA,CAAA8E,OAAa,CAACa,IAAI;UAClBC,KAAK,EAAC,QAAQ;UACdZ,SAAS,EAAC;QAAkC,CAC5C,CAAC,eACF,IAAArE,WAAA,CAAAkE,GAAA,EAAC7E,cAAA,CAAA8E,OAAa,CAACa,IAAI;UAClBC,KAAK,EAAC,OAAO;UACbZ,SAAS,EAAC;QAAkC,CAC5C,CAAC,eACF,IAAArE,WAAA,CAAAkE,GAAA,EAACrE,iBAAA,CAAAsE,OAA0B,CAACe,QAAQ;UACnCC,KAAK,EAAGxE,SAAS,EAAEyE,IAAM;UAAAZ,QAAA,eAEzB,IAAAxE,WAAA,CAAAkE,GAAA,EAAC5E,qBAAA,CAAA6E,OAA8B,CAACa,IAAI,IAAE;QAAC,CACH,CAAC;MAAA,CACrC,CACF,eACD,IAAAhF,WAAA,CAAAkE,GAAA,EAACxE,wBAAA,CAAAyE,OAAuB;QAACQ,SAAS,EAAGnE;MAAgB,CAAE,CAAC,EACtDE,oBAAoB,iBACrB,IAAAV,WAAA,CAAAkE,GAAA,EAAC3E,kBAAA,CAAA4E,OAAiB;QAACQ,SAAS,EAAGnE;MAAgB,CAAE,CACjD;IAAA,CACG;EAAC,GArEAI,UAsEW,CAAC;AAErB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASyE,YAAYA,CAAE;EAAEnF,cAAc;EAAEI;AAAQ,CAAC,EAAG;EACnE,oBACC,IAAAN,WAAA,CAAAkE,GAAA,EAACjE,mBAAmB;IACnBC,cAAc,EAAGA,cAAgB;IACjCI,OAAO,EAAGA,OAAS;IACnBH,YAAY,EAAGoE,SAAW;IAC1BnE,0BAA0B,EAAGmE,SAAW;IACxClE,2BAA2B,EAAGkE;EAAW,CACzC,CAAC;AAEJ","ignoreList":[]}
@@ -45,7 +45,11 @@ function Shuffle({
45
45
  const _categories = attributes?.metadata?.categories || EMPTY_ARRAY;
46
46
  const _patternName = attributes?.metadata?.patternName;
47
47
  const rootBlock = getBlockRootClientId(clientId);
48
- const _patterns = __experimentalGetAllowedPatterns(rootBlock);
48
+
49
+ // Calling `__experimentalGetAllowedPatterns` is expensive.
50
+ // Checking if the block can be shuffled prevents unnecessary selector calls.
51
+ // See: https://github.com/WordPress/gutenberg/pull/64736.
52
+ const _patterns = _categories.length > 0 ? __experimentalGetAllowedPatterns(rootBlock) : EMPTY_ARRAY;
49
53
  return {
50
54
  categories: _categories,
51
55
  patterns: _patterns,
@@ -56,7 +60,7 @@ function Shuffle({
56
60
  replaceBlocks
57
61
  } = (0, _data.useDispatch)(_store.store);
58
62
  const sameCategoryPatternsWithSingleWrapper = (0, _element.useMemo)(() => {
59
- if (!categories || categories.length === 0 || !patterns || patterns.length === 0) {
63
+ if (categories.length === 0 || !patterns || patterns.length === 0) {
60
64
  return EMPTY_ARRAY;
61
65
  }
62
66
  return patterns.filter(pattern => {
@@ -1 +1 @@
1
- {"version":3,"names":["_icons","require","_components","_i18n","_element","_data","_store","_jsxRuntime","EMPTY_ARRAY","Container","props","jsx","ToolbarGroup","children","ToolbarButton","Shuffle","clientId","as","categories","patterns","patternName","useSelect","select","getBlockAttributes","getBlockRootClientId","__experimentalGetAllowedPatterns","blockEditorStore","attributes","_categories","metadata","_patternName","rootBlock","_patterns","replaceBlocks","useDispatch","sameCategoryPatternsWithSingleWrapper","useMemo","length","filter","pattern","isCorePattern","source","startsWith","blocks","some","category","includes","syncStatus","id","getNextPattern","numberOfPatterns","patternIndex","findIndex","name","nextPatternIndex","ComponentToUse","label","__","icon","shuffle","className","onClick","nextPattern"],"sources":["@wordpress/block-editor/src/components/block-toolbar/shuffle.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { shuffle } from '@wordpress/icons';\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nconst EMPTY_ARRAY = [];\n\nfunction Container( props ) {\n\treturn (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarButton { ...props } />\n\t\t</ToolbarGroup>\n\t);\n}\n\nexport default function Shuffle( { clientId, as = Container } ) {\n\tconst { categories, patterns, patternName } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\t__experimentalGetAllowedPatterns,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\tconst _categories = attributes?.metadata?.categories || EMPTY_ARRAY;\n\t\t\tconst _patternName = attributes?.metadata?.patternName;\n\t\t\tconst rootBlock = getBlockRootClientId( clientId );\n\t\t\tconst _patterns = __experimentalGetAllowedPatterns( rootBlock );\n\t\t\treturn {\n\t\t\t\tcategories: _categories,\n\t\t\t\tpatterns: _patterns,\n\t\t\t\tpatternName: _patternName,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst sameCategoryPatternsWithSingleWrapper = useMemo( () => {\n\t\tif (\n\t\t\t! categories ||\n\t\t\tcategories.length === 0 ||\n\t\t\t! patterns ||\n\t\t\tpatterns.length === 0\n\t\t) {\n\t\t\treturn EMPTY_ARRAY;\n\t\t}\n\t\treturn patterns.filter( ( pattern ) => {\n\t\t\tconst isCorePattern =\n\t\t\t\tpattern.source === 'core' ||\n\t\t\t\t( pattern.source?.startsWith( 'pattern-directory' ) &&\n\t\t\t\t\tpattern.source !== 'pattern-directory/theme' );\n\t\t\treturn (\n\t\t\t\t// Check if the pattern has only one top level block,\n\t\t\t\t// otherwise we may shuffle to pattern that will not allow to continue shuffling.\n\t\t\t\tpattern.blocks.length === 1 &&\n\t\t\t\t// We exclude the core patterns and pattern directory patterns that are not theme patterns.\n\t\t\t\t! isCorePattern &&\n\t\t\t\tpattern.categories?.some( ( category ) => {\n\t\t\t\t\treturn categories.includes( category );\n\t\t\t\t} ) &&\n\t\t\t\t// Check if the pattern is not a synced pattern.\n\t\t\t\t( pattern.syncStatus === 'unsynced' || ! pattern.id )\n\t\t\t);\n\t\t} );\n\t}, [ categories, patterns ] );\n\n\tif ( sameCategoryPatternsWithSingleWrapper.length < 2 ) {\n\t\treturn null;\n\t}\n\n\tfunction getNextPattern() {\n\t\tconst numberOfPatterns = sameCategoryPatternsWithSingleWrapper.length;\n\t\tconst patternIndex = sameCategoryPatternsWithSingleWrapper.findIndex(\n\t\t\t( { name } ) => name === patternName\n\t\t);\n\t\tconst nextPatternIndex =\n\t\t\tpatternIndex + 1 < numberOfPatterns ? patternIndex + 1 : 0;\n\t\treturn sameCategoryPatternsWithSingleWrapper[ nextPatternIndex ];\n\t}\n\n\tconst ComponentToUse = as;\n\treturn (\n\t\t<ComponentToUse\n\t\t\tlabel={ __( 'Shuffle' ) }\n\t\t\ticon={ shuffle }\n\t\t\tclassName=\"block-editor-block-toolbar-shuffle\"\n\t\t\tonClick={ () => {\n\t\t\t\tconst nextPattern = getNextPattern();\n\t\t\t\tnextPattern.blocks[ 0 ].attributes = {\n\t\t\t\t\t...nextPattern.blocks[ 0 ].attributes,\n\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t...nextPattern.blocks[ 0 ].attributes.metadata,\n\t\t\t\t\t\tcategories,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\treplaceBlocks( clientId, nextPattern.blocks );\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAAwD,IAAAM,WAAA,GAAAN,OAAA;AAZxD;AACA;AACA;;AA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C,OAAO,EAAGA,CAAA,KAAM;MACf,MAAMC,WAAW,GAAGb,cAAc,CAAC,CAAC;MACpCa,WAAW,CAACnB,MAAM,CAAE,CAAC,CAAE,CAAChB,UAAU,GAAG;QACpC,GAAGmC,WAAW,CAACnB,MAAM,CAAE,CAAC,CAAE,CAAChB,UAAU;QACrCE,QAAQ,EAAE;UACT,GAAGiC,WAAW,CAACnB,MAAM,CAAE,CAAC,CAAE,CAAChB,UAAU,CAACE,QAAQ;UAC9CX;QACD;MACD,CAAC;MACDe,aAAa,CAAEjB,QAAQ,EAAE8C,WAAW,CAACnB,MAAO,CAAC;IAC9C;EAAG,CACH,CAAC;AAEJ","ignoreList":[]}
1
+ {"version":3,"names":["_icons","require","_components","_i18n","_element","_data","_store","_jsxRuntime","EMPTY_ARRAY","Container","props","jsx","ToolbarGroup","children","ToolbarButton","Shuffle","clientId","as","categories","patterns","patternName","useSelect","select","getBlockAttributes","getBlockRootClientId","__experimentalGetAllowedPatterns","blockEditorStore","attributes","_categories","metadata","_patternName","rootBlock","_patterns","length","replaceBlocks","useDispatch","sameCategoryPatternsWithSingleWrapper","useMemo","filter","pattern","isCorePattern","source","startsWith","blocks","some","category","includes","syncStatus","id","getNextPattern","numberOfPatterns","patternIndex","findIndex","name","nextPatternIndex","ComponentToUse","label","__","icon","shuffle","className","onClick","nextPattern"],"sources":["@wordpress/block-editor/src/components/block-toolbar/shuffle.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { shuffle } from '@wordpress/icons';\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nconst EMPTY_ARRAY = [];\n\nfunction Container( props ) {\n\treturn (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarButton { ...props } />\n\t\t</ToolbarGroup>\n\t);\n}\n\nexport default function Shuffle( { clientId, as = Container } ) {\n\tconst { categories, patterns, patternName } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\t__experimentalGetAllowedPatterns,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\tconst _categories = attributes?.metadata?.categories || EMPTY_ARRAY;\n\t\t\tconst _patternName = attributes?.metadata?.patternName;\n\t\t\tconst rootBlock = getBlockRootClientId( clientId );\n\n\t\t\t// Calling `__experimentalGetAllowedPatterns` is expensive.\n\t\t\t// Checking if the block can be shuffled prevents unnecessary selector calls.\n\t\t\t// See: https://github.com/WordPress/gutenberg/pull/64736.\n\t\t\tconst _patterns =\n\t\t\t\t_categories.length > 0\n\t\t\t\t\t? __experimentalGetAllowedPatterns( rootBlock )\n\t\t\t\t\t: EMPTY_ARRAY;\n\t\t\treturn {\n\t\t\t\tcategories: _categories,\n\t\t\t\tpatterns: _patterns,\n\t\t\t\tpatternName: _patternName,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst sameCategoryPatternsWithSingleWrapper = useMemo( () => {\n\t\tif ( categories.length === 0 || ! patterns || patterns.length === 0 ) {\n\t\t\treturn EMPTY_ARRAY;\n\t\t}\n\t\treturn patterns.filter( ( pattern ) => {\n\t\t\tconst isCorePattern =\n\t\t\t\tpattern.source === 'core' ||\n\t\t\t\t( pattern.source?.startsWith( 'pattern-directory' ) &&\n\t\t\t\t\tpattern.source !== 'pattern-directory/theme' );\n\t\t\treturn (\n\t\t\t\t// Check if the pattern has only one top level block,\n\t\t\t\t// otherwise we may shuffle to pattern that will not allow to continue shuffling.\n\t\t\t\tpattern.blocks.length === 1 &&\n\t\t\t\t// We exclude the core patterns and pattern directory patterns that are not theme patterns.\n\t\t\t\t! isCorePattern &&\n\t\t\t\tpattern.categories?.some( ( category ) => {\n\t\t\t\t\treturn categories.includes( category );\n\t\t\t\t} ) &&\n\t\t\t\t// Check if the pattern is not a synced pattern.\n\t\t\t\t( pattern.syncStatus === 'unsynced' || ! pattern.id )\n\t\t\t);\n\t\t} );\n\t}, [ categories, patterns ] );\n\n\tif ( sameCategoryPatternsWithSingleWrapper.length < 2 ) {\n\t\treturn null;\n\t}\n\n\tfunction getNextPattern() {\n\t\tconst numberOfPatterns = sameCategoryPatternsWithSingleWrapper.length;\n\t\tconst patternIndex = sameCategoryPatternsWithSingleWrapper.findIndex(\n\t\t\t( { name } ) => name === patternName\n\t\t);\n\t\tconst nextPatternIndex =\n\t\t\tpatternIndex + 1 < numberOfPatterns ? patternIndex + 1 : 0;\n\t\treturn sameCategoryPatternsWithSingleWrapper[ nextPatternIndex ];\n\t}\n\n\tconst ComponentToUse = as;\n\treturn (\n\t\t<ComponentToUse\n\t\t\tlabel={ __( 'Shuffle' ) }\n\t\t\ticon={ shuffle }\n\t\t\tclassName=\"block-editor-block-toolbar-shuffle\"\n\t\t\tonClick={ () => {\n\t\t\t\tconst nextPattern = getNextPattern();\n\t\t\t\tnextPattern.blocks[ 0 ].attributes = {\n\t\t\t\t\t...nextPattern.blocks[ 0 ].attributes,\n\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t...nextPattern.blocks[ 0 ].attributes.metadata,\n\t\t\t\t\t\tcategories,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\treplaceBlocks( clientId, nextPattern.blocks );\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAAwD,IAAAM,WAAA,GAAAN,OAAA;AAZxD;AACA;AACA;;AAOA;AACA;AACA;;AAGA,MAAM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AAS,EAAC,oCAAoC;IAC9CC,OAAO,EAAGA,CAAA,KAAM;MACf,MAAMC,WAAW,GAAGb,cAAc,CAAC,CAAC;MACpCa,WAAW,CAACnB,MAAM,CAAE,CAAC,CAAE,CAAChB,UAAU,GAAG;QACpC,GAAGmC,WAAW,CAACnB,MAAM,CAAE,CAAC,CAAE,CAAChB,UAAU;QACrCE,QAAQ,EAAE;UACT,GAAGiC,WAAW,CAACnB,MAAM,CAAE,CAAC,CAAE,CAAChB,UAAU,CAACE,QAAQ;UAC9CX;QACD;MACD,CAAC;MACDgB,aAAa,CAAElB,QAAQ,EAAE8C,WAAW,CAACnB,MAAO,CAAC;IAC9C;EAAG,CACH,CAAC;AAEJ","ignoreList":[]}
@@ -221,7 +221,10 @@ var _jsxRuntime = require("react/jsx-runtime");
221
221
  }), showBlockDraggable && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FlexItem, {
222
222
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockDraggable.default, {
223
223
  clientIds: [clientId],
224
- children: draggableProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
224
+ children: draggableProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button
225
+ // TODO: Switch to `true` (40px size) if possible
226
+ , {
227
+ __next40pxDefaultSize: false,
225
228
  icon: _icons.dragHandle,
226
229
  className: "block-selection-button_drag-handle",
227
230
  label: dragHandleLabel
@@ -233,7 +236,10 @@ var _jsxRuntime = require("react/jsx-runtime");
233
236
  })
234
237
  })
235
238
  }), editorMode === 'navigation' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FlexItem, {
236
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
239
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button
240
+ // TODO: Switch to `true` (40px size) if possible
241
+ , {
242
+ __next40pxDefaultSize: false,
237
243
  ref: ref,
238
244
  onClick: editorMode === 'navigation' ? () => setNavigationMode(false) : undefined,
239
245
  onKeyDown: onKeyDown,
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_icons","_components","_data","_element","_keycodes","_blocks","_a11y","_dom","_i18n","_blockTitle","_blockIcon","_store","_blockDraggable","_useBlockRefs","_jsxRuntime","BlockSelectionButton","clientId","rootClientId","ref","selected","useSelect","select","getBlock","getBlockIndex","hasBlockMovingClientId","getBlockListSettings","__unstableGetEditorMode","getNextBlockClientId","getPreviousBlockClientId","canMoveBlock","blockEditorStore","getActiveBlockVariation","getBlockType","blocksStore","index","name","attributes","blockType","orientation","match","blockMovingMode","editorMode","icon","label","getAccessibleBlockLabel","canMove","setNavigationMode","removeBlock","useDispatch","useEffect","current","focus","speak","blockElement","useBlockElement","getBlockRootClientId","getClientIdsOfDescendants","getSelectedBlockClientId","getMultiSelectedBlocksEndClientId","selectBlock","clearSelectedBlock","setBlockMovingClientId","moveBlockToPosition","onKeyDown","event","keyCode","isUp","UP","isDown","DOWN","isLeft","LEFT","isRight","RIGHT","isTab","TAB","isEscape","ESCAPE","isEnter","ENTER","isSpace","SPACE","isShift","shiftKey","BACKSPACE","DELETE","preventDefault","selectedBlockClientId","selectionEndClientId","selectionBeforeEndClientId","selectionAfterEndClientId","navigateUp","navigateDown","navigateOut","navigateIn","focusedBlockUid","_getBlockRootClientId","_getClientIdsOfDescen","startingBlockClientId","defaultPrevented","sourceRoot","destRoot","sourceBlockIndex","destinationBlockIndex","nextTabbable","tabbable","findNext","contains","ownerDocument","defaultView","frameElement","findPrevious","classNames","clsx","dragHandleLabel","__","showBlockDraggable","jsx","className","children","jsxs","Flex","justify","FlexItem","default","showColors","clientIds","draggableProps","Button","dragHandle","tabIndex","onClick","undefined","showTooltip","maximumLength","_default","exports","forwardRef"],"sources":["@wordpress/block-editor/src/components/block-tools/block-selection-button.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { dragHandle } from '@wordpress/icons';\nimport { Button, Flex, FlexItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { forwardRef, useEffect } from '@wordpress/element';\nimport {\n\tBACKSPACE,\n\tDELETE,\n\tUP,\n\tDOWN,\n\tLEFT,\n\tRIGHT,\n\tTAB,\n\tESCAPE,\n\tENTER,\n\tSPACE,\n} from '@wordpress/keycodes';\nimport {\n\t__experimentalGetAccessibleBlockLabel as getAccessibleBlockLabel,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { speak } from '@wordpress/a11y';\nimport { focus } from '@wordpress/dom';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockTitle from '../block-title';\nimport BlockIcon from '../block-icon';\nimport { store as blockEditorStore } from '../../store';\nimport BlockDraggable from '../block-draggable';\nimport { useBlockElement } from '../block-list/use-block-props/use-block-refs';\n\n/**\n * Block selection button component, displaying the label of the block. If the block\n * descends from a root block, a button is displayed enabling the user to select\n * the root block.\n *\n * @param {string} props Component props.\n * @param {string} props.clientId Client ID of block.\n * @param {Object} ref Reference to the component.\n *\n * @return {Component} The component to be rendered.\n */\nfunction BlockSelectionButton( { clientId, rootClientId }, ref ) {\n\tconst selected = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlock,\n\t\t\t\tgetBlockIndex,\n\t\t\t\thasBlockMovingClientId,\n\t\t\t\tgetBlockListSettings,\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t\tgetNextBlockClientId,\n\t\t\t\tgetPreviousBlockClientId,\n\t\t\t\tcanMoveBlock,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { getActiveBlockVariation, getBlockType } =\n\t\t\t\tselect( blocksStore );\n\t\t\tconst index = getBlockIndex( clientId );\n\t\t\tconst { name, attributes } = getBlock( clientId );\n\t\t\tconst blockType = getBlockType( name );\n\t\t\tconst orientation =\n\t\t\t\tgetBlockListSettings( rootClientId )?.orientation;\n\t\t\tconst match = getActiveBlockVariation( name, attributes );\n\n\t\t\treturn {\n\t\t\t\tblockMovingMode: hasBlockMovingClientId(),\n\t\t\t\teditorMode: __unstableGetEditorMode(),\n\t\t\t\ticon: match?.icon || blockType.icon,\n\t\t\t\tlabel: getAccessibleBlockLabel(\n\t\t\t\t\tblockType,\n\t\t\t\t\tattributes,\n\t\t\t\t\tindex + 1,\n\t\t\t\t\torientation\n\t\t\t\t),\n\t\t\t\tcanMove: canMoveBlock( clientId, rootClientId ),\n\t\t\t\tgetNextBlockClientId,\n\t\t\t\tgetPreviousBlockClientId,\n\t\t\t};\n\t\t},\n\t\t[ clientId, rootClientId ]\n\t);\n\tconst { label, icon, blockMovingMode, editorMode, canMove } = selected;\n\tconst { setNavigationMode, removeBlock } = useDispatch( blockEditorStore );\n\n\t// Focus the breadcrumb in navigation mode.\n\tuseEffect( () => {\n\t\tif ( editorMode === 'navigation' ) {\n\t\t\tref.current.focus();\n\t\t\tspeak( label );\n\t\t}\n\t}, [ label, editorMode ] );\n\tconst blockElement = useBlockElement( clientId );\n\n\tconst {\n\t\thasBlockMovingClientId,\n\t\tgetBlockIndex,\n\t\tgetBlockRootClientId,\n\t\tgetClientIdsOfDescendants,\n\t\tgetSelectedBlockClientId,\n\t\tgetMultiSelectedBlocksEndClientId,\n\t\tgetPreviousBlockClientId,\n\t\tgetNextBlockClientId,\n\t} = useSelect( blockEditorStore );\n\tconst {\n\t\tselectBlock,\n\t\tclearSelectedBlock,\n\t\tsetBlockMovingClientId,\n\t\tmoveBlockToPosition,\n\t} = useDispatch( blockEditorStore );\n\n\tfunction onKeyDown( event ) {\n\t\tconst { keyCode } = event;\n\t\tconst isUp = keyCode === UP;\n\t\tconst isDown = keyCode === DOWN;\n\t\tconst isLeft = keyCode === LEFT;\n\t\tconst isRight = keyCode === RIGHT;\n\t\tconst isTab = keyCode === TAB;\n\t\tconst isEscape = keyCode === ESCAPE;\n\t\tconst isEnter = keyCode === ENTER;\n\t\tconst isSpace = keyCode === SPACE;\n\t\tconst isShift = event.shiftKey;\n\n\t\tif ( keyCode === BACKSPACE || keyCode === DELETE ) {\n\t\t\tremoveBlock( clientId );\n\t\t\tevent.preventDefault();\n\t\t\treturn;\n\t\t}\n\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\tconst selectionEndClientId = getMultiSelectedBlocksEndClientId();\n\t\tconst selectionBeforeEndClientId = getPreviousBlockClientId(\n\t\t\tselectionEndClientId || selectedBlockClientId\n\t\t);\n\t\tconst selectionAfterEndClientId = getNextBlockClientId(\n\t\t\tselectionEndClientId || selectedBlockClientId\n\t\t);\n\n\t\tconst navigateUp = ( isTab && isShift ) || isUp;\n\t\tconst navigateDown = ( isTab && ! isShift ) || isDown;\n\t\t// Move out of current nesting level (no effect if at root level).\n\t\tconst navigateOut = isLeft;\n\t\t// Move into next nesting level (no effect if the current block has no innerBlocks).\n\t\tconst navigateIn = isRight;\n\n\t\tlet focusedBlockUid;\n\t\tif ( navigateUp ) {\n\t\t\tfocusedBlockUid = selectionBeforeEndClientId;\n\t\t} else if ( navigateDown ) {\n\t\t\tfocusedBlockUid = selectionAfterEndClientId;\n\t\t} else if ( navigateOut ) {\n\t\t\tfocusedBlockUid =\n\t\t\t\tgetBlockRootClientId( selectedBlockClientId ) ??\n\t\t\t\tselectedBlockClientId;\n\t\t} else if ( navigateIn ) {\n\t\t\tfocusedBlockUid =\n\t\t\t\tgetClientIdsOfDescendants( selectedBlockClientId )[ 0 ] ??\n\t\t\t\tselectedBlockClientId;\n\t\t}\n\t\tconst startingBlockClientId = hasBlockMovingClientId();\n\t\tif ( isEscape && startingBlockClientId && ! event.defaultPrevented ) {\n\t\t\tsetBlockMovingClientId( null );\n\t\t\tevent.preventDefault();\n\t\t}\n\t\tif ( ( isEnter || isSpace ) && startingBlockClientId ) {\n\t\t\tconst sourceRoot = getBlockRootClientId( startingBlockClientId );\n\t\t\tconst destRoot = getBlockRootClientId( selectedBlockClientId );\n\t\t\tconst sourceBlockIndex = getBlockIndex( startingBlockClientId );\n\t\t\tlet destinationBlockIndex = getBlockIndex( selectedBlockClientId );\n\t\t\tif (\n\t\t\t\tsourceBlockIndex < destinationBlockIndex &&\n\t\t\t\tsourceRoot === destRoot\n\t\t\t) {\n\t\t\t\tdestinationBlockIndex -= 1;\n\t\t\t}\n\t\t\tmoveBlockToPosition(\n\t\t\t\tstartingBlockClientId,\n\t\t\t\tsourceRoot,\n\t\t\t\tdestRoot,\n\t\t\t\tdestinationBlockIndex\n\t\t\t);\n\t\t\tselectBlock( startingBlockClientId );\n\t\t\tsetBlockMovingClientId( null );\n\t\t}\n\t\t// Prevent the block from being moved into itself.\n\t\tif (\n\t\t\tstartingBlockClientId &&\n\t\t\tselectedBlockClientId === startingBlockClientId &&\n\t\t\tnavigateIn\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tif ( navigateDown || navigateUp || navigateOut || navigateIn ) {\n\t\t\tif ( focusedBlockUid ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tselectBlock( focusedBlockUid );\n\t\t\t} else if ( isTab && selectedBlockClientId ) {\n\t\t\t\tlet nextTabbable;\n\n\t\t\t\tif ( navigateDown ) {\n\t\t\t\t\tnextTabbable = blockElement;\n\t\t\t\t\tdo {\n\t\t\t\t\t\tnextTabbable = focus.tabbable.findNext( nextTabbable );\n\t\t\t\t\t} while (\n\t\t\t\t\t\tnextTabbable &&\n\t\t\t\t\t\tblockElement.contains( nextTabbable )\n\t\t\t\t\t);\n\n\t\t\t\t\tif ( ! nextTabbable ) {\n\t\t\t\t\t\tnextTabbable =\n\t\t\t\t\t\t\tblockElement.ownerDocument.defaultView.frameElement;\n\t\t\t\t\t\tnextTabbable = focus.tabbable.findNext( nextTabbable );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tnextTabbable = focus.tabbable.findPrevious( blockElement );\n\t\t\t\t}\n\n\t\t\t\tif ( nextTabbable ) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tnextTabbable.focus();\n\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tconst classNames = clsx(\n\t\t'block-editor-block-list__block-selection-button',\n\t\t{\n\t\t\t'is-block-moving-mode': !! blockMovingMode,\n\t\t}\n\t);\n\n\tconst dragHandleLabel = __( 'Drag' );\n\tconst showBlockDraggable = canMove && editorMode === 'navigation';\n\n\treturn (\n\t\t<div className={ classNames }>\n\t\t\t<Flex\n\t\t\t\tjustify=\"center\"\n\t\t\t\tclassName=\"block-editor-block-list__block-selection-button__content\"\n\t\t\t>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<BlockIcon icon={ icon } showColors />\n\t\t\t\t</FlexItem>\n\t\t\t\t{ showBlockDraggable && (\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<BlockDraggable clientIds={ [ clientId ] }>\n\t\t\t\t\t\t\t{ ( draggableProps ) => (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\ticon={ dragHandle }\n\t\t\t\t\t\t\t\t\tclassName=\"block-selection-button_drag-handle\"\n\t\t\t\t\t\t\t\t\tlabel={ dragHandleLabel }\n\t\t\t\t\t\t\t\t\t// Should not be able to tab to drag handle as this\n\t\t\t\t\t\t\t\t\t// button can only be used with a pointer device.\n\t\t\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t\t\t\t{ ...draggableProps }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</BlockDraggable>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t) }\n\t\t\t\t{ editorMode === 'navigation' && (\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\teditorMode === 'navigation'\n\t\t\t\t\t\t\t\t\t? () => setNavigationMode( false )\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\tshowTooltip={ false }\n\t\t\t\t\t\t\tclassName=\"block-selection-button_select-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockTitle\n\t\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\t\tmaximumLength={ 35 }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t) }\n\t\t\t</Flex>\n\t\t</div>\n\t);\n}\n\nexport default forwardRef( BlockSelectionButton );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAYA,IAAAM,OAAA,GAAAN,OAAA;AAIA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,IAAA,GAAAR,OAAA;AACA,IAAAS,KAAA,GAAAT,OAAA;AAKA,IAAAU,WAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,UAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AACA,IAAAa,eAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,aAAA,GAAAd,OAAA;AAA+E,IAAAe,WAAA,GAAAf,OAAA;AAvC/E;AACA;AACA;;AAGA;AACA;AACA;;AAyBA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,SAASgB,oBAAoBA,CAAE;EAAEC,QAAQ;EAAEC;AAAa,CAAC,EAAEC,GAAG,EAAG;EAChE,MAAMC,QAAQ,GAAG,IAAAC,eAAS,EACvBC,MAAM,IAAM;IACb,MAAM;MACLC,QAAQ;MACRC,aAAa;M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AAA,GACRH;UAAc,CACnB;QACD,CACc;MAAC,CACR,CACV,EACCtF,UAAU,KAAK,YAAY,iBAC5B,IAAA3B,WAAA,CAAAuG,GAAA,EAACpH,WAAA,CAAA0H,QAAQ;QAAAJ,QAAA,eACR,IAAAzG,WAAA,CAAAuG,GAAA,EAACpH,WAAA,CAAA+H,MAAM;UACN9G,GAAG,EAAGA,GAAK;UACXiH,OAAO,EACN1F,UAAU,KAAK,YAAY,GACxB,MAAMK,iBAAiB,CAAE,KAAM,CAAC,GAChCsF,SACH;UACDrE,SAAS,EAAGA,SAAW;UACvBpB,KAAK,EAAGA,KAAO;UACf0F,WAAW,EAAG,KAAO;UACrBf,SAAS,EAAC,sCAAsC;UAAAC,QAAA,eAEhD,IAAAzG,WAAA,CAAAuG,GAAA,EAAC5G,WAAA,CAAAmH,OAAU;YACV5G,QAAQ,EAAGA,QAAU;YACrBsH,aAAa,EAAG;UAAI,CACpB;QAAC,CACK;MAAC,CACA,CACV;IAAA,CACI;EAAC,CACH,CAAC;AAER;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAZ,OAAA,GAEc,IAAAa,mBAAU,EAAE1H,oBAAqB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_icons","_components","_data","_element","_keycodes","_blocks","_a11y","_dom","_i18n","_blockTitle","_blockIcon","_store","_blockDraggable","_useBlockRefs","_jsxRuntime","BlockSelectionButton","clientId","rootClientId","ref","selected","useSelect","select","getBlock","getBlockIndex","hasBlockMovingClientId","getBlockListSettings","__unstableGetEditorMode","getNextBlockClientId","getPreviousBlockClientId","canMoveBlock","blockEditorStore","getActiveBlockVariation","getBlockType","blocksStore","index","name","attributes","blockType","orientation","match","blockMovingMode","editorMode","icon","label","getAccessibleBlockLabel","canMove","setNavigationMode","removeBlock","useDispatch","useEffect","current","focus","speak","blockElement","useBlockElement","getBlockRootClientId","getClientIdsOfDescendants","getSelectedBlockClientId","getMultiSelectedBlocksEndClientId","selectBlock","clearSelectedBlock","setBlockMovingClientId","moveBlockToPosition","onKeyDown","event","keyCode","isUp","UP","isDown","DOWN","isLeft","LEFT","isRight","RIGHT","isTab","TAB","isEscape","ESCAPE","isEnter","ENTER","isSpace","SPACE","isShift","shiftKey","BACKSPACE","DELETE","preventDefault","selectedBlockClientId","selectionEndClientId","selectionBeforeEndClientId","selectionAfterEndClientId","navigateUp","navigateDown","navigateOut","navigateIn","focusedBlockUid","_getBlockRootClientId","_getClientIdsOfDescen","startingBlockClientId","defaultPrevented","sourceRoot","destRoot","sourceBlockIndex","destinationBlockIndex","nextTabbable","tabbable","findNext","contains","ownerDocument","defaultView","frameElement","findPrevious","classNames","clsx","dragHandleLabel","__","showBlockDraggable","jsx","className","children","jsxs","Flex","justify","FlexItem","default","showColors","clientIds","draggableProps","Button","__next40pxDefaultSize","dragHandle","tabIndex","onClick","undefined","showTooltip","maximumLength","_default","exports","forwardRef"],"sources":["@wordpress/block-editor/src/components/block-tools/block-selection-button.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { dragHandle } from '@wordpress/icons';\nimport { Button, Flex, FlexItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { forwardRef, useEffect } from '@wordpress/element';\nimport {\n\tBACKSPACE,\n\tDELETE,\n\tUP,\n\tDOWN,\n\tLEFT,\n\tRIGHT,\n\tTAB,\n\tESCAPE,\n\tENTER,\n\tSPACE,\n} from '@wordpress/keycodes';\nimport {\n\t__experimentalGetAccessibleBlockLabel as getAccessibleBlockLabel,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { speak } from '@wordpress/a11y';\nimport { focus } from '@wordpress/dom';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockTitle from '../block-title';\nimport BlockIcon from '../block-icon';\nimport { store as blockEditorStore } from '../../store';\nimport BlockDraggable from '../block-draggable';\nimport { useBlockElement } from '../block-list/use-block-props/use-block-refs';\n\n/**\n * Block selection button component, displaying the label of the block. If the block\n * descends from a root block, a button is displayed enabling the user to select\n * the root block.\n *\n * @param {string} props Component props.\n * @param {string} props.clientId Client ID of block.\n * @param {Object} ref Reference to the component.\n *\n * @return {Component} The component to be rendered.\n */\nfunction BlockSelectionButton( { clientId, rootClientId }, ref ) {\n\tconst selected = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlock,\n\t\t\t\tgetBlockIndex,\n\t\t\t\thasBlockMovingClientId,\n\t\t\t\tgetBlockListSettings,\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t\tgetNextBlockClientId,\n\t\t\t\tgetPreviousBlockClientId,\n\t\t\t\tcanMoveBlock,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { getActiveBlockVariation, getBlockType } =\n\t\t\t\tselect( blocksStore );\n\t\t\tconst index = getBlockIndex( clientId );\n\t\t\tconst { name, attributes } = getBlock( clientId );\n\t\t\tconst blockType = getBlockType( name );\n\t\t\tconst orientation =\n\t\t\t\tgetBlockListSettings( rootClientId )?.orientation;\n\t\t\tconst match = getActiveBlockVariation( name, attributes );\n\n\t\t\treturn {\n\t\t\t\tblockMovingMode: hasBlockMovingClientId(),\n\t\t\t\teditorMode: __unstableGetEditorMode(),\n\t\t\t\ticon: match?.icon || blockType.icon,\n\t\t\t\tlabel: getAccessibleBlockLabel(\n\t\t\t\t\tblockType,\n\t\t\t\t\tattributes,\n\t\t\t\t\tindex + 1,\n\t\t\t\t\torientation\n\t\t\t\t),\n\t\t\t\tcanMove: canMoveBlock( clientId, rootClientId ),\n\t\t\t\tgetNextBlockClientId,\n\t\t\t\tgetPreviousBlockClientId,\n\t\t\t};\n\t\t},\n\t\t[ clientId, rootClientId ]\n\t);\n\tconst { label, icon, blockMovingMode, editorMode, canMove } = selected;\n\tconst { setNavigationMode, removeBlock } = useDispatch( blockEditorStore );\n\n\t// Focus the breadcrumb in navigation mode.\n\tuseEffect( () => {\n\t\tif ( editorMode === 'navigation' ) {\n\t\t\tref.current.focus();\n\t\t\tspeak( label );\n\t\t}\n\t}, [ label, editorMode ] );\n\tconst blockElement = useBlockElement( clientId );\n\n\tconst {\n\t\thasBlockMovingClientId,\n\t\tgetBlockIndex,\n\t\tgetBlockRootClientId,\n\t\tgetClientIdsOfDescendants,\n\t\tgetSelectedBlockClientId,\n\t\tgetMultiSelectedBlocksEndClientId,\n\t\tgetPreviousBlockClientId,\n\t\tgetNextBlockClientId,\n\t} = useSelect( blockEditorStore );\n\tconst {\n\t\tselectBlock,\n\t\tclearSelectedBlock,\n\t\tsetBlockMovingClientId,\n\t\tmoveBlockToPosition,\n\t} = useDispatch( blockEditorStore );\n\n\tfunction onKeyDown( event ) {\n\t\tconst { keyCode } = event;\n\t\tconst isUp = keyCode === UP;\n\t\tconst isDown = keyCode === DOWN;\n\t\tconst isLeft = keyCode === LEFT;\n\t\tconst isRight = keyCode === RIGHT;\n\t\tconst isTab = keyCode === TAB;\n\t\tconst isEscape = keyCode === ESCAPE;\n\t\tconst isEnter = keyCode === ENTER;\n\t\tconst isSpace = keyCode === SPACE;\n\t\tconst isShift = event.shiftKey;\n\n\t\tif ( keyCode === BACKSPACE || keyCode === DELETE ) {\n\t\t\tremoveBlock( clientId );\n\t\t\tevent.preventDefault();\n\t\t\treturn;\n\t\t}\n\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\tconst selectionEndClientId = getMultiSelectedBlocksEndClientId();\n\t\tconst selectionBeforeEndClientId = getPreviousBlockClientId(\n\t\t\tselectionEndClientId || selectedBlockClientId\n\t\t);\n\t\tconst selectionAfterEndClientId = getNextBlockClientId(\n\t\t\tselectionEndClientId || selectedBlockClientId\n\t\t);\n\n\t\tconst navigateUp = ( isTab && isShift ) || isUp;\n\t\tconst navigateDown = ( isTab && ! isShift ) || isDown;\n\t\t// Move out of current nesting level (no effect if at root level).\n\t\tconst navigateOut = isLeft;\n\t\t// Move into next nesting level (no effect if the current block has no innerBlocks).\n\t\tconst navigateIn = isRight;\n\n\t\tlet focusedBlockUid;\n\t\tif ( navigateUp ) {\n\t\t\tfocusedBlockUid = selectionBeforeEndClientId;\n\t\t} else if ( navigateDown ) {\n\t\t\tfocusedBlockUid = selectionAfterEndClientId;\n\t\t} else if ( navigateOut ) {\n\t\t\tfocusedBlockUid =\n\t\t\t\tgetBlockRootClientId( selectedBlockClientId ) ??\n\t\t\t\tselectedBlockClientId;\n\t\t} else if ( navigateIn ) {\n\t\t\tfocusedBlockUid =\n\t\t\t\tgetClientIdsOfDescendants( selectedBlockClientId )[ 0 ] ??\n\t\t\t\tselectedBlockClientId;\n\t\t}\n\t\tconst startingBlockClientId = hasBlockMovingClientId();\n\t\tif ( isEscape && startingBlockClientId && ! event.defaultPrevented ) {\n\t\t\tsetBlockMovingClientId( null );\n\t\t\tevent.preventDefault();\n\t\t}\n\t\tif ( ( isEnter || isSpace ) && startingBlockClientId ) {\n\t\t\tconst sourceRoot = getBlockRootClientId( startingBlockClientId );\n\t\t\tconst destRoot = getBlockRootClientId( selectedBlockClientId );\n\t\t\tconst sourceBlockIndex = getBlockIndex( startingBlockClientId );\n\t\t\tlet destinationBlockIndex = getBlockIndex( selectedBlockClientId );\n\t\t\tif (\n\t\t\t\tsourceBlockIndex < destinationBlockIndex &&\n\t\t\t\tsourceRoot === destRoot\n\t\t\t) {\n\t\t\t\tdestinationBlockIndex -= 1;\n\t\t\t}\n\t\t\tmoveBlockToPosition(\n\t\t\t\tstartingBlockClientId,\n\t\t\t\tsourceRoot,\n\t\t\t\tdestRoot,\n\t\t\t\tdestinationBlockIndex\n\t\t\t);\n\t\t\tselectBlock( startingBlockClientId );\n\t\t\tsetBlockMovingClientId( null );\n\t\t}\n\t\t// Prevent the block from being moved into itself.\n\t\tif (\n\t\t\tstartingBlockClientId &&\n\t\t\tselectedBlockClientId === startingBlockClientId &&\n\t\t\tnavigateIn\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tif ( navigateDown || navigateUp || navigateOut || navigateIn ) {\n\t\t\tif ( focusedBlockUid ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tselectBlock( focusedBlockUid );\n\t\t\t} else if ( isTab && selectedBlockClientId ) {\n\t\t\t\tlet nextTabbable;\n\n\t\t\t\tif ( navigateDown ) {\n\t\t\t\t\tnextTabbable = blockElement;\n\t\t\t\t\tdo {\n\t\t\t\t\t\tnextTabbable = focus.tabbable.findNext( nextTabbable );\n\t\t\t\t\t} while (\n\t\t\t\t\t\tnextTabbable &&\n\t\t\t\t\t\tblockElement.contains( nextTabbable )\n\t\t\t\t\t);\n\n\t\t\t\t\tif ( ! nextTabbable ) {\n\t\t\t\t\t\tnextTabbable =\n\t\t\t\t\t\t\tblockElement.ownerDocument.defaultView.frameElement;\n\t\t\t\t\t\tnextTabbable = focus.tabbable.findNext( nextTabbable );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tnextTabbable = focus.tabbable.findPrevious( blockElement );\n\t\t\t\t}\n\n\t\t\t\tif ( nextTabbable ) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tnextTabbable.focus();\n\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tconst classNames = clsx(\n\t\t'block-editor-block-list__block-selection-button',\n\t\t{\n\t\t\t'is-block-moving-mode': !! blockMovingMode,\n\t\t}\n\t);\n\n\tconst dragHandleLabel = __( 'Drag' );\n\tconst showBlockDraggable = canMove && editorMode === 'navigation';\n\n\treturn (\n\t\t<div className={ classNames }>\n\t\t\t<Flex\n\t\t\t\tjustify=\"center\"\n\t\t\t\tclassName=\"block-editor-block-list__block-selection-button__content\"\n\t\t\t>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<BlockIcon icon={ icon } showColors />\n\t\t\t\t</FlexItem>\n\t\t\t\t{ showBlockDraggable && (\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<BlockDraggable clientIds={ [ clientId ] }>\n\t\t\t\t\t\t\t{ ( draggableProps ) => (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize={ false }\n\t\t\t\t\t\t\t\t\ticon={ dragHandle }\n\t\t\t\t\t\t\t\t\tclassName=\"block-selection-button_drag-handle\"\n\t\t\t\t\t\t\t\t\tlabel={ dragHandleLabel }\n\t\t\t\t\t\t\t\t\t// Should not be able to tab to drag handle as this\n\t\t\t\t\t\t\t\t\t// button can only be used with a pointer device.\n\t\t\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t\t\t\t{ ...draggableProps }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</BlockDraggable>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t) }\n\t\t\t\t{ editorMode === 'navigation' && (\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t\t\t\t__next40pxDefaultSize={ false }\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\teditorMode === 'navigation'\n\t\t\t\t\t\t\t\t\t? () => setNavigationMode( false )\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\tshowTooltip={ false }\n\t\t\t\t\t\t\tclassName=\"block-selection-button_select-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockTitle\n\t\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\t\tmaximumLength={ 35 }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t) }\n\t\t\t</Flex>\n\t\t</div>\n\t);\n}\n\nexport default forward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AK,YAAY,GACxB,MAAMK,iBAAiB,CAAE,KAAM,CAAC,GAChCuF,SACH;UACDtE,SAAS,EAAGA,SAAW;UACvBpB,KAAK,EAAGA,KAAO;UACf2F,WAAW,EAAG,KAAO;UACrBhB,SAAS,EAAC,sCAAsC;UAAAC,QAAA,eAEhD,IAAAzG,WAAA,CAAAuG,GAAA,EAAC5G,WAAA,CAAAmH,OAAU;YACV5G,QAAQ,EAAGA,QAAU;YACrBuH,aAAa,EAAG;UAAI,CACpB;QAAC,CACK;MAAC,CACA,CACV;IAAA,CACI;EAAC,CACH,CAAC;AAER;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAb,OAAA,GAEc,IAAAc,mBAAU,EAAE3H,oBAAqB,CAAC","ignoreList":[]}
@@ -49,20 +49,24 @@ function BlockToolbarPopover({
49
49
  const {
50
50
  stopTyping
51
51
  } = (0, _data.useDispatch)(_store.store);
52
- const isToolbarForced = (0, _element.useRef)(false);
52
+ const isToolbarForcedRef = (0, _element.useRef)(false);
53
53
  (0, _keyboardShortcuts.useShortcut)('core/block-editor/focus-toolbar', () => {
54
- isToolbarForced.current = true;
54
+ isToolbarForcedRef.current = true;
55
55
  stopTyping(true);
56
56
  });
57
57
  (0, _element.useEffect)(() => {
58
- isToolbarForced.current = false;
58
+ isToolbarForcedRef.current = false;
59
59
  });
60
+
61
+ // If the block has a parent with __experimentalCaptureToolbars enabled,
62
+ // the toolbar should be positioned over the topmost capturing parent.
63
+ const clientIdToPositionOver = capturingClientId || clientId;
60
64
  const popoverProps = (0, _useBlockToolbarPopoverProps.default)({
61
65
  contentElement: __unstableContentRef?.current,
62
- clientId
66
+ clientId: clientIdToPositionOver
63
67
  });
64
68
  return !isTyping && /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockPopover.default, {
65
- clientId: capturingClientId || clientId,
69
+ clientId: clientIdToPositionOver,
66
70
  bottomClientId: lastClientId,
67
71
  className: (0, _clsx.default)('block-editor-block-list__block-popover', {
68
72
  'is-insertion-point-visible': isInsertionPointVisible
@@ -73,7 +77,7 @@ function BlockToolbarPopover({
73
77
  // If the toolbar is being shown because of being forced
74
78
  // it should focus the toolbar right after the mount.
75
79
  , {
76
- focusOnMount: isToolbarForced.current,
80
+ focusOnMount: isToolbarForcedRef.current,
77
81
  __experimentalInitialIndex: initialToolbarItemIndexRef.current,
78
82
  __experimentalOnIndexChange: index => {
79
83
  initialToolbarItemIndexRef.current = index;
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_data","_element","_keyboardShortcuts","_blockPopover","_useBlockToolbarPopoverProps","_useSelectedBlockToolProps","_store","_blockToolbar","_jsxRuntime","BlockToolbarPopover","clientId","isTyping","__unstableContentRef","capturingClientId","isInsertionPointVisible","lastClientId","useSelectedBlockToolProps","initialToolbarItemIndexRef","useRef","useEffect","current","undefined","stopTyping","useDispatch","blockEditorStore","isToolbarForced","useShortcut","popoverProps","useBlockToolbarPopoverProps","contentElement","jsx","default","bottomClientId","className","clsx","resize","children","PrivateBlockToolbar","focusOnMount","__experimentalInitialIndex","__experimentalOnIndexChange","index","variant"],"sources":["@wordpress/block-editor/src/components/block-tools/block-toolbar-popover.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\n/**\n * Internal dependencies\n */\nimport BlockPopover from '../block-popover';\nimport useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';\nimport useSelectedBlockToolProps from './use-selected-block-tool-props';\nimport { store as blockEditorStore } from '../../store';\nimport { PrivateBlockToolbar } from '../block-toolbar';\n\nexport default function BlockToolbarPopover( {\n\tclientId,\n\tisTyping,\n\t__unstableContentRef,\n} ) {\n\tconst { capturingClientId, isInsertionPointVisible, lastClientId } =\n\t\tuseSelectedBlockToolProps( clientId );\n\n\t// Stores the active toolbar item index so the block toolbar can return focus\n\t// to it when re-mounting.\n\tconst initialToolbarItemIndexRef = useRef();\n\n\tuseEffect( () => {\n\t\t// Resets the index whenever the active block changes so this is not\n\t\t// persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\tinitialToolbarItemIndexRef.current = undefined;\n\t}, [ clientId ] );\n\n\tconst { stopTyping } = useDispatch( blockEditorStore );\n\tconst isToolbarForced = useRef( false );\n\n\tuseShortcut( 'core/block-editor/focus-toolbar', () => {\n\t\tisToolbarForced.current = true;\n\t\tstopTyping( true );\n\t} );\n\n\tuseEffect( () => {\n\t\tisToolbarForced.current = false;\n\t} );\n\n\tconst popoverProps = useBlockToolbarPopoverProps( {\n\t\tcontentElement: __unstableContentRef?.current,\n\t\tclientId,\n\t} );\n\n\treturn (\n\t\t! isTyping && (\n\t\t\t<BlockPopover\n\t\t\t\tclientId={ capturingClientId || clientId }\n\t\t\t\tbottomClientId={ lastClientId }\n\t\t\t\tclassName={ clsx( 'block-editor-block-list__block-popover', {\n\t\t\t\t\t'is-insertion-point-visible': isInsertionPointVisible,\n\t\t\t\t} ) }\n\t\t\t\tresize={ false }\n\t\t\t\t{ ...popoverProps }\n\t\t\t>\n\t\t\t\t<PrivateBlockToolbar\n\t\t\t\t\t// If the toolbar is being shown because of being forced\n\t\t\t\t\t// it should focus the toolbar right after the mount.\n\t\t\t\t\tfocusOnMount={ isToolbarForced.current }\n\t\t\t\t\t__experimentalInitialIndex={\n\t\t\t\t\t\tinitialToolbarItemIndexRef.current\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalOnIndexChange={ ( index ) => {\n\t\t\t\t\t\tinitialToolbarItemIndexRef.current = index;\n\t\t\t\t\t} }\n\t\t\t\t\tvariant=\"toolbar\"\n\t\t\t\t/>\n\t\t\t</BlockPopover>\n\t\t)\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA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AAAsB,GAAA,EAAC3B,aAAA,CAAA4B,OAAY;IACZrB,QAAQ,EAAGG,iBAAiB,IAAIH,QAAU;IAC1CsB,cAAc,EAAGjB,YAAc;IAC/BkB,SAAS,EAAG,IAAAC,aAAI,EAAE,wCAAwC,EAAE;MAC3D,4BAA4B,EAAEpB;IAC/B,CAAE,CAAG;IACLqB,MAAM,EAAG,KAAO;IAAA,GACXR,YAAY;IAAAS,QAAA,eAEjB,IAAA5B,WAAA,CAAAsB,GAAA,EAACvB,aAAA,CAAA8B;IACA;IACA;IAAA;MACAC,YAAY,EAAGb,eAAe,CAACL,OAAS;MACxCmB,0BAA0B,EACzBtB,0BAA0B,CAACG,OAC3B;MACDoB,2BAA2B,EAAKC,KAAK,IAAM;QAC1CxB,0BAA0B,CAACG,OAAO,GAAGqB,KAAK;MAC3C,CAAG;MACHC,OAAO,EAAC;IAAS,CACjB;EAAC,CACW,CACd;AAEH","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_data","_element","_keyboardShortcuts","_blockPopover","_useBlockToolbarPopoverProps","_useSelectedBlockToolProps","_store","_blockToolbar","_jsxRuntime","BlockToolbarPopover","clientId","isTyping","__unstableContentRef","capturingClientId","isInsertionPointVisible","lastClientId","useSelectedBlockToolProps","initialToolbarItemIndexRef","useRef","useEffect","current","undefined","stopTyping","useDispatch","blockEditorStore","isToolbarForcedRef","useShortcut","clientIdToPositionOver","popoverProps","useBlockToolbarPopoverProps","contentElement","jsx","default","bottomClientId","className","clsx","resize","children","PrivateBlockToolbar","focusOnMount","__experimentalInitialIndex","__experimentalOnIndexChange","index","variant"],"sources":["@wordpress/block-editor/src/components/block-tools/block-toolbar-popover.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\n/**\n * Internal dependencies\n */\nimport BlockPopover from '../block-popover';\nimport useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';\nimport useSelectedBlockToolProps from './use-selected-block-tool-props';\nimport { store as blockEditorStore } from '../../store';\nimport { PrivateBlockToolbar } from '../block-toolbar';\n\nexport default function BlockToolbarPopover( {\n\tclientId,\n\tisTyping,\n\t__unstableContentRef,\n} ) {\n\tconst { capturingClientId, isInsertionPointVisible, lastClientId } =\n\t\tuseSelectedBlockToolProps( clientId );\n\n\t// Stores the active toolbar item index so the block toolbar can return focus\n\t// to it when re-mounting.\n\tconst initialToolbarItemIndexRef = useRef();\n\n\tuseEffect( () => {\n\t\t// Resets the index whenever the active block changes so this is not\n\t\t// persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\tinitialToolbarItemIndexRef.current = undefined;\n\t}, [ clientId ] );\n\n\tconst { stopTyping } = useDispatch( blockEditorStore );\n\tconst isToolbarForcedRef = useRef( false );\n\n\tuseShortcut( 'core/block-editor/focus-toolbar', () => {\n\t\tisToolbarForcedRef.current = true;\n\t\tstopTyping( true );\n\t} );\n\n\tuseEffect( () => {\n\t\tisToolbarForcedRef.current = false;\n\t} );\n\n\t// If the block has a parent with __experimentalCaptureToolbars enabled,\n\t// the toolbar should be positioned over the topmost capturing parent.\n\tconst clientIdToPositionOver = capturingClientId || clientId;\n\n\tconst popoverProps = useBlockToolbarPopoverProps( {\n\t\tcontentElement: __unstableContentRef?.current,\n\t\tclientId: clientIdToPositionOver,\n\t} );\n\n\treturn (\n\t\t! isTyping && (\n\t\t\t<BlockPopover\n\t\t\t\tclientId={ clientIdToPositionOver }\n\t\t\t\tbottomClientId={ lastClientId }\n\t\t\t\tclassName={ clsx( 'block-editor-block-list__block-popover', {\n\t\t\t\t\t'is-insertion-point-visible': isInsertionPointVisible,\n\t\t\t\t} ) }\n\t\t\t\tresize={ false }\n\t\t\t\t{ ...popoverProps }\n\t\t\t>\n\t\t\t\t<PrivateBlockToolbar\n\t\t\t\t\t// If the toolbar is being shown because of being forced\n\t\t\t\t\t// it should focus the toolbar right after the mount.\n\t\t\t\t\tfocusOnMount={ isToolbarForcedRef.current }\n\t\t\t\t\t__experimentalInitialIndex={\n\t\t\t\t\t\tinitialToolbarItemIndexRef.current\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalOnIndexChange={ ( index ) => {\n\t\t\t\t\t\tinitialToolbarItemIndexRef.current = index;\n\t\t\t\t\t} }\n\t\t\t\t\tvariant=\"toolbar\"\n\t\t\t\t/>\n\t\t\t</BlockPopover>\n\t\t)\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AAIA,IAAAI,aAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,4BAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,0BAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAR,OAAA;AAAuD,IAAAS,WAAA,GAAAT,OAAA;AAjBvD;AACA;AACA;;AAEA;AACA;AACA;;AAIA;AACA;AACA;;AAOe,SAASU,mBAAmBA,CAAE;EAC5CC,QAAQ;EACRC,QAAQ;EACRC;AACD,CAAC,EAAG;EACH,MAAM;IAAEC,iBAAiB;IAAEC,uBAAuB;IAAEC;EAAa,CAAC,GACjE,IAAAC,kCAAyB,EAAEN,QAAS,CAAC;;EAEtC;EACA;EACA,MAAMO,0BAA0B,GAAG,IAAAC,eAAM,EAAC,CAAC;EAE3C,IAAAC,kBAAS,EAAE,MAAM;IAChB;IACA;IACAF,0BAA0B,CAACG,OAAO,GAAGC,SAAS;EAC/C,CAAC,EAAE,CAAEX,QAAQ,CAAG,CAAC;EAEjB,MAAM;IAAEY;EAAW,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAiB,CAAC;EACtD,MAAMC,kBAAkB,GAAG,IAAAP,eAAM,EAAE,KAAM,CAAC;EAE1C,IAAAQ,8BAAW,EAAE,iCAAiC,EAAE,MAAM;IACrDD,kBAAkB,CAACL,OAAO,GAAG,IAAI;IACjCE,UAAU,CAAE,IAAK,CAAC;EACnB,CAAE,CAAC;EAEH,IAAAH,kBAAS,EAAE,MAAM;IAChBM,kBAAkB,CAACL,OAAO,GAAG,KAAK;EACnC,CAAE,CAAC;;EAEH;EACA;EACA,MAAMO,sBAAsB,GAAGd,iBAAiB,IAAIH,QAAQ;EAE5D,MAAMkB,YAAY,GAAG,IAAAC,oCAA2B,EAAE;IACjDC,cAAc,EAAElB,oBAAoB,EAAEQ,OAAO;IAC7CV,QAAQ,EAAEiB;EACX,CAAE,CAAC;EAEH,OACC,CAAEhB,QAAQ,iBACT,IAAAH,WAAA,CAAAuB,GAAA,EAAC5B,aAAA,CAAA6B,OAAY;IACZtB,QAAQ,EAAGiB,sBAAwB;IACnCM,cAAc,EAAGlB,YAAc;IAC/BmB,SAAS,EAAG,IAAAC,aAAI,EAAE,wCAAwC,EAAE;MAC3D,4BAA4B,EAAErB;IAC/B,CAAE,CAAG;IACLsB,MAAM,EAAG,KAAO;IAAA,GACXR,YAAY;IAAAS,QAAA,eAEjB,IAAA7B,WAAA,CAAAuB,GAAA,EAACxB,aAAA,CAAA+B;IACA;IACA;IAAA;MACAC,YAAY,EAAGd,kBAAkB,CAACL,OAAS;MAC3CoB,0BAA0B,EACzBvB,0BAA0B,CAACG,OAC3B;MACDqB,2BAA2B,EAAKC,KAAK,IAAM;QAC1CzB,0BAA0B,CAACG,OAAO,GAAGsB,KAAK;MAC3C,CAAG;MACHC,OAAO,EAAC;IAAS,CACjB;EAAC,CACW,CACd;AAEH","ignoreList":[]}
@@ -11,6 +11,7 @@ var _element = require("@wordpress/element");
11
11
  var _store = require("../../store");
12
12
  var _useBlockRefs = require("../block-list/use-block-props/use-block-refs");
13
13
  var _position = require("../../hooks/position");
14
+ var _dom2 = require("../../utils/dom");
14
15
  /**
15
16
  * WordPress dependencies
16
17
  */
@@ -61,7 +62,7 @@ function getProps(contentElement, selectedBlockElement, scrollContainer, toolbar
61
62
 
62
63
  // Get how far the content area has been scrolled.
63
64
  const scrollTop = scrollContainer?.scrollTop || 0;
64
- const blockRect = selectedBlockElement.getBoundingClientRect();
65
+ const blockRect = (0, _dom2.getVisibleElementBounds)(selectedBlockElement);
65
66
  const contentRect = contentElement.getBoundingClientRect();
66
67
 
67
68
  // Get the vertical position of top of the visible content area.
@@ -1 +1 @@
1
- {"version":3,"names":["_compose","require","_data","_dom","_element","_store","_useBlockRefs","_position","COMMON_PROPS","placement","DEFAULT_PROPS","flip","shift","RESTRICTED_HEIGHT_PROPS","getProps","contentElement","selectedBlockElement","scrollContainer","toolbarHeight","isSticky","scrollTop","blockRect","getBoundingClientRect","contentRect","topOfContentElementInViewport","top","viewportHeight","ownerDocument","documentElement","clientHeight","restrictedTopArea","hasSpaceForToolbarAbove","isBlockTallerThanViewport","height","useBlockToolbarPopoverProps","clientId","useBlockElement","setToolbarHeight","useState","blockIndex","useSelect","select","getBlockIndex","getBlockAttributes","blockEditorStore","hasStickyOrFixedPositionValue","useMemo","getScrollContainer","props","setProps","popoverRef","useRefEffect","popoverNode","offsetHeight","updateProps","useCallback","useLayoutEffect","contentView","defaultView","addEventHandler","resizeObserver","blockView","ResizeObserver","observe","removeEventHandler","disconnect","ref"],"sources":["@wordpress/block-editor/src/components/block-tools/use-block-toolbar-popover-props.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { getScrollContainer } from '@wordpress/dom';\nimport {\n\tuseCallback,\n\tuseLayoutEffect,\n\tuseMemo,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport { hasStickyOrFixedPositionValue } from '../../hooks/position';\n\nconst COMMON_PROPS = {\n\tplacement: 'top-start',\n};\n\n// By default the toolbar sets the `shift` prop. If the user scrolls the page\n// down the toolbar will stay on screen by adopting a sticky position at the\n// top of the viewport.\nconst DEFAULT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: false,\n\tshift: true,\n};\n\n// When there isn't enough height between the top of the block and the editor\n// canvas, the `shift` prop is set to `false`, as it will cause the block to be\n// obscured. The `flip` behavior is enabled, which positions the toolbar below\n// the block. This only happens if the block is smaller than the viewport, as\n// otherwise the toolbar will be off-screen.\nconst RESTRICTED_HEIGHT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: true,\n\tshift: false,\n};\n\n/**\n * Get the popover props for the block toolbar, determined by the space at the top of the canvas and the toolbar height.\n *\n * @param {Element} contentElement The DOM element that represents the editor content or canvas.\n * @param {Element} selectedBlockElement The outer DOM element of the first selected block.\n * @param {Element} scrollContainer The scrollable container for the contentElement.\n * @param {number} toolbarHeight The height of the toolbar in pixels.\n * @param {boolean} isSticky Whether or not the selected block is sticky or fixed.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nfunction getProps(\n\tcontentElement,\n\tselectedBlockElement,\n\tscrollContainer,\n\ttoolbarHeight,\n\tisSticky\n) {\n\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\t// Get how far the content area has been scrolled.\n\tconst scrollTop = scrollContainer?.scrollTop || 0;\n\n\tconst blockRect = selectedBlockElement.getBoundingClientRect();\n\tconst contentRect = contentElement.getBoundingClientRect();\n\n\t// Get the vertical position of top of the visible content area.\n\tconst topOfContentElementInViewport = scrollTop + contentRect.top;\n\n\t// The document element's clientHeight represents the viewport height.\n\tconst viewportHeight =\n\t\tcontentElement.ownerDocument.documentElement.clientHeight;\n\n\t// The restricted height area is calculated as the sum of the\n\t// vertical position of the visible content area, plus the height\n\t// of the block toolbar.\n\tconst restrictedTopArea = topOfContentElementInViewport + toolbarHeight;\n\tconst hasSpaceForToolbarAbove = blockRect.top > restrictedTopArea;\n\n\tconst isBlockTallerThanViewport =\n\t\tblockRect.height > viewportHeight - toolbarHeight;\n\n\t// Sticky blocks are treated as if they will never have enough space for the toolbar above.\n\tif (\n\t\t! isSticky &&\n\t\t( hasSpaceForToolbarAbove || isBlockTallerThanViewport )\n\t) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\treturn RESTRICTED_HEIGHT_PROPS;\n}\n\n/**\n * Determines the desired popover positioning behavior, returning a set of appropriate props.\n *\n * @param {Object} elements\n * @param {Element} elements.contentElement The DOM element that represents the editor content or canvas.\n * @param {string} elements.clientId The clientId of the first selected block.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nexport default function useBlockToolbarPopoverProps( {\n\tcontentElement,\n\tclientId,\n} ) {\n\tconst selectedBlockElement = useBlockElement( clientId );\n\tconst [ toolbarHeight, setToolbarHeight ] = useState( 0 );\n\tconst { blockIndex, isSticky } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockIndex, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\tisSticky: hasStickyOrFixedPositionValue(\n\t\t\t\t\tgetBlockAttributes( clientId )\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst scrollContainer = useMemo( () => {\n\t\tif ( ! contentElement ) {\n\t\t\treturn;\n\t\t}\n\t\treturn getScrollContainer( contentElement );\n\t}, [ contentElement ] );\n\tconst [ props, setProps ] = useState( () =>\n\t\tgetProps(\n\t\t\tcontentElement,\n\t\t\tselectedBlockElement,\n\t\t\tscrollContainer,\n\t\t\ttoolbarHeight,\n\t\t\tisSticky\n\t\t)\n\t);\n\n\tconst popoverRef = useRefEffect( ( popoverNode ) => {\n\t\tsetToolbarHeight( popoverNode.offsetHeight );\n\t}, [] );\n\n\tconst updateProps = useCallback(\n\t\t() =>\n\t\t\tsetProps(\n\t\t\t\tgetProps(\n\t\t\t\t\tcontentElement,\n\t\t\t\t\tselectedBlockElement,\n\t\t\t\t\tscrollContainer,\n\t\t\t\t\ttoolbarHeight,\n\t\t\t\t\tisSticky\n\t\t\t\t)\n\t\t\t),\n\t\t[ contentElement, selectedBlockElement, scrollContainer, toolbarHeight ]\n\t);\n\n\t// Update props when the block is moved. This also ensures the props are\n\t// correct on initial mount, and when the selected block or content element\n\t// changes (since the callback ref will update).\n\tuseLayoutEffect( updateProps, [ blockIndex, updateProps ] );\n\n\t// Update props when the viewport is resized or the block is resized.\n\tuseLayoutEffect( () => {\n\t\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Update the toolbar props on viewport resize.\n\t\tconst contentView = contentElement?.ownerDocument?.defaultView;\n\t\tcontentView?.addEventHandler?.( 'resize', updateProps );\n\n\t\t// Update the toolbar props on block resize.\n\t\tlet resizeObserver;\n\t\tconst blockView = selectedBlockElement?.ownerDocument?.defaultView;\n\t\tif ( blockView.ResizeObserver ) {\n\t\t\tresizeObserver = new blockView.ResizeObserver( updateProps );\n\t\t\tresizeObserver.observe( selectedBlockElement );\n\t\t}\n\n\t\treturn () => {\n\t\t\tcontentView?.removeEventHandler?.( 'resize', updateProps );\n\n\t\t\tif ( resizeObserver ) {\n\t\t\t\tresizeObserver.disconnect();\n\t\t\t}\n\t\t};\n\t}, [ updateProps, contentElement, selectedBlockElement ] );\n\n\treturn {\n\t\t...props,\n\t\tref: popoverRef,\n\t};\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAUA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAlBA;AACA;AACA;;AAWA;AACA;AACA;;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eAAe,EAAEC,aAAa,CACvE,CAAC;;EAED;EACA;EACA;EACA,IAAAsC,wBAAe,EAAEF,WAAW,EAAE,CAAEf,UAAU,EAAEe,WAAW,CAAG,CAAC;;EAE3D;EACA,IAAAE,wBAAe,EAAE,MAAM;IACtB,IAAK,CAAEzC,cAAc,IAAI,CAAEC,oBAAoB,EAAG;MACjD;IACD;;IAEA;IACA,MAAMyC,WAAW,GAAG1C,cAAc,EAAEY,aAAa,EAAE+B,WAAW;IAC9DD,WAAW,EAAEE,eAAe,GAAI,QAAQ,EAAEL,WAAY,CAAC;;IAEvD;IACA,IAAIM,cAAc;IAClB,MAAMC,SAAS,GAAG7C,oBAAoB,EAAEW,aAAa,EAAE+B,WAAW;IAClE,IAAKG,SAAS,CAACC,cAAc,EAAG;MAC/BF,cAAc,GAAG,IAAIC,SAAS,CAACC,cAAc,CAAER,WAAY,CAAC;MAC5DM,cAAc,CAACG,OAAO,CAAE/C,oBAAqB,CAAC;IAC/C;IAEA,OAAO,MAAM;MACZyC,WAAW,EAAEO,kBAAkB,GAAI,QAAQ,EAAEV,WAAY,CAAC;MAE1D,IAAKM,cAAc,EAAG;QACrBA,cAAc,CAACK,UAAU,CAAC,CAAC;MAC5B;IACD,CAAC;EACF,CAAC,EAAE,CAAEX,WAAW,EAAEvC,cAAc,EAAEC,oBAAoB,CAAG,CAAC;EAE1D,OAAO;IACN,GAAGgC,KAAK;IACRkB,GAAG,EAAEhB;EACN,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["_compose","require","_data","_dom","_element","_store","_useBlockRefs","_position","_dom2","COMMON_PROPS","placement","DEFAULT_PROPS","flip","shift","RESTRICTED_HEIGHT_PROPS","getProps","contentElement","selectedBlockElement","scrollContainer","toolbarHeight","isSticky","scrollTop","blockRect","getVisibleElementBounds","contentRect","getBoundingClientRect","topOfContentElementInViewport","top","viewportHeight","ownerDocument","documentElement","clientHeight","restrictedTopArea","hasSpaceForToolbarAbove","isBlockTallerThanViewport","height","useBlockToolbarPopoverProps","clientId","useBlockElement","setToolbarHeight","useState","blockIndex","useSelect","select","getBlockIndex","getBlockAttributes","blockEditorStore","hasStickyOrFixedPositionValue","useMemo","getScrollContainer","props","setProps","popoverRef","useRefEffect","popoverNode","offsetHeight","updateProps","useCallback","useLayoutEffect","contentView","defaultView","addEventHandler","resizeObserver","blockView","ResizeObserver","observe","removeEventHandler","disconnect","ref"],"sources":["@wordpress/block-editor/src/components/block-tools/use-block-toolbar-popover-props.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { getScrollContainer } from '@wordpress/dom';\nimport {\n\tuseCallback,\n\tuseLayoutEffect,\n\tuseMemo,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport { hasStickyOrFixedPositionValue } from '../../hooks/position';\nimport { getVisibleElementBounds } from '../../utils/dom';\n\nconst COMMON_PROPS = {\n\tplacement: 'top-start',\n};\n\n// By default the toolbar sets the `shift` prop. If the user scrolls the page\n// down the toolbar will stay on screen by adopting a sticky position at the\n// top of the viewport.\nconst DEFAULT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: false,\n\tshift: true,\n};\n\n// When there isn't enough height between the top of the block and the editor\n// canvas, the `shift` prop is set to `false`, as it will cause the block to be\n// obscured. The `flip` behavior is enabled, which positions the toolbar below\n// the block. This only happens if the block is smaller than the viewport, as\n// otherwise the toolbar will be off-screen.\nconst RESTRICTED_HEIGHT_PROPS = {\n\t...COMMON_PROPS,\n\tflip: true,\n\tshift: false,\n};\n\n/**\n * Get the popover props for the block toolbar, determined by the space at the top of the canvas and the toolbar height.\n *\n * @param {Element} contentElement The DOM element that represents the editor content or canvas.\n * @param {Element} selectedBlockElement The outer DOM element of the first selected block.\n * @param {Element} scrollContainer The scrollable container for the contentElement.\n * @param {number} toolbarHeight The height of the toolbar in pixels.\n * @param {boolean} isSticky Whether or not the selected block is sticky or fixed.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nfunction getProps(\n\tcontentElement,\n\tselectedBlockElement,\n\tscrollContainer,\n\ttoolbarHeight,\n\tisSticky\n) {\n\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\t// Get how far the content area has been scrolled.\n\tconst scrollTop = scrollContainer?.scrollTop || 0;\n\n\tconst blockRect = getVisibleElementBounds( selectedBlockElement );\n\tconst contentRect = contentElement.getBoundingClientRect();\n\n\t// Get the vertical position of top of the visible content area.\n\tconst topOfContentElementInViewport = scrollTop + contentRect.top;\n\n\t// The document element's clientHeight represents the viewport height.\n\tconst viewportHeight =\n\t\tcontentElement.ownerDocument.documentElement.clientHeight;\n\n\t// The restricted height area is calculated as the sum of the\n\t// vertical position of the visible content area, plus the height\n\t// of the block toolbar.\n\tconst restrictedTopArea = topOfContentElementInViewport + toolbarHeight;\n\tconst hasSpaceForToolbarAbove = blockRect.top > restrictedTopArea;\n\n\tconst isBlockTallerThanViewport =\n\t\tblockRect.height > viewportHeight - toolbarHeight;\n\n\t// Sticky blocks are treated as if they will never have enough space for the toolbar above.\n\tif (\n\t\t! isSticky &&\n\t\t( hasSpaceForToolbarAbove || isBlockTallerThanViewport )\n\t) {\n\t\treturn DEFAULT_PROPS;\n\t}\n\n\treturn RESTRICTED_HEIGHT_PROPS;\n}\n\n/**\n * Determines the desired popover positioning behavior, returning a set of appropriate props.\n *\n * @param {Object} elements\n * @param {Element} elements.contentElement The DOM element that represents the editor content or canvas.\n * @param {string} elements.clientId The clientId of the first selected block.\n *\n * @return {Object} The popover props used to determine the position of the toolbar.\n */\nexport default function useBlockToolbarPopoverProps( {\n\tcontentElement,\n\tclientId,\n} ) {\n\tconst selectedBlockElement = useBlockElement( clientId );\n\tconst [ toolbarHeight, setToolbarHeight ] = useState( 0 );\n\tconst { blockIndex, isSticky } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockIndex, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\tisSticky: hasStickyOrFixedPositionValue(\n\t\t\t\t\tgetBlockAttributes( clientId )\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst scrollContainer = useMemo( () => {\n\t\tif ( ! contentElement ) {\n\t\t\treturn;\n\t\t}\n\t\treturn getScrollContainer( contentElement );\n\t}, [ contentElement ] );\n\tconst [ props, setProps ] = useState( () =>\n\t\tgetProps(\n\t\t\tcontentElement,\n\t\t\tselectedBlockElement,\n\t\t\tscrollContainer,\n\t\t\ttoolbarHeight,\n\t\t\tisSticky\n\t\t)\n\t);\n\n\tconst popoverRef = useRefEffect( ( popoverNode ) => {\n\t\tsetToolbarHeight( popoverNode.offsetHeight );\n\t}, [] );\n\n\tconst updateProps = useCallback(\n\t\t() =>\n\t\t\tsetProps(\n\t\t\t\tgetProps(\n\t\t\t\t\tcontentElement,\n\t\t\t\t\tselectedBlockElement,\n\t\t\t\t\tscrollContainer,\n\t\t\t\t\ttoolbarHeight,\n\t\t\t\t\tisSticky\n\t\t\t\t)\n\t\t\t),\n\t\t[ contentElement, selectedBlockElement, scrollContainer, toolbarHeight ]\n\t);\n\n\t// Update props when the block is moved. This also ensures the props are\n\t// correct on initial mount, and when the selected block or content element\n\t// changes (since the callback ref will update).\n\tuseLayoutEffect( updateProps, [ blockIndex, updateProps ] );\n\n\t// Update props when the viewport is resized or the block is resized.\n\tuseLayoutEffect( () => {\n\t\tif ( ! contentElement || ! selectedBlockElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Update the toolbar props on viewport resize.\n\t\tconst contentView = contentElement?.ownerDocument?.defaultView;\n\t\tcontentView?.addEventHandler?.( 'resize', updateProps );\n\n\t\t// Update the toolbar props on block resize.\n\t\tlet resizeObserver;\n\t\tconst blockView = selectedBlockElement?.ownerDocument?.defaultView;\n\t\tif ( blockView.ResizeObserver ) {\n\t\t\tresizeObserver = new blockView.ResizeObserver( updateProps );\n\t\t\tresizeObserver.observe( selectedBlockElement );\n\t\t}\n\n\t\treturn () => {\n\t\t\tcontentView?.removeEventHandler?.( 'resize', updateProps );\n\n\t\t\tif ( resizeObserver ) {\n\t\t\t\tresizeObserver.disconnect();\n\t\t\t}\n\t\t};\n\t}, [ updateProps, contentElement, selectedBlockElement ] );\n\n\treturn {\n\t\t...props,\n\t\tref: popoverRef,\n\t};\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAUA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AAnBA;AACA;AACA;;AAWA;AACA;AACA;;AAMA,MAAMQ,YAAY,GAAG;EACpBC,SAAS,EAAE;AACZ,CAAC;;AAED;AACA;AACA;AACA,MAAMC,aAAa,GAAG;EACrB,GAAGF,YAAY;EACfG,IAAI,EAAE,KAAK;EACXC,KAAK,EAAE;AACR,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMC,uBAAuB,GAAG;EAC/B,GAAGL,YAAY;EACfG,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE;AACR,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,QAAQA,CAChBC,cAAc,EACdC,oBAAoB,EACpBC,eAAe,EACfC,aAAa,EACbC,QAAQ,EACP;EACD,IAAK,CAAEJ,cAAc,IAAI,CAAEC,oBAAoB,EAAG;IACjD,OAAON,aAAa;EACrB;;EAEA;EACA,MAAMU,SAAS,GAAGH,eAAe,EAAEG,SAAS,IAAI,CAAC;EAEjD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D,oBAAqB,CAAC;IAC/C;IAEA,OAAO,MAAM;MACZ0C,WAAW,EAAEO,kBAAkB,GAAI,QAAQ,EAAEV,WAAY,CAAC;MAE1D,IAAKM,cAAc,EAAG;QACrBA,cAAc,CAACK,UAAU,CAAC,CAAC;MAC5B;IACD,CAAC;EACF,CAAC,EAAE,CAAEX,WAAW,EAAExC,cAAc,EAAEC,oBAAoB,CAAG,CAAC;EAE1D,OAAO;IACN,GAAGiC,KAAK;IACRkB,GAAG,EAAEhB;EACN,CAAC;AACF","ignoreList":[]}
@@ -30,8 +30,7 @@ function ZoomOutModeInserters() {
30
30
  setInserterIsOpened,
31
31
  sectionRootClientId,
32
32
  selectedBlockClientId,
33
- hoveredBlockClientId,
34
- inserterSearchInputRef
33
+ hoveredBlockClientId
35
34
  } = (0, _data.useSelect)(select => {
36
35
  const {
37
36
  getSettings,
@@ -41,11 +40,9 @@ function ZoomOutModeInserters() {
41
40
  getSelectedBlockClientId,
42
41
  getHoveredBlockClientId,
43
42
  isBlockInsertionPointVisible,
44
- getInserterSearchInputRef
43
+ getSectionRootClientId
45
44
  } = (0, _lockUnlock.unlock)(select(_store.store));
46
- const {
47
- sectionRootClientId: root
48
- } = (0, _lockUnlock.unlock)(getSettings());
45
+ const root = getSectionRootClientId();
49
46
  return {
50
47
  hasSelection: !!getSelectionStart().clientId,
51
48
  blockInsertionPoint: getBlockInsertionPoint(),
@@ -54,8 +51,7 @@ function ZoomOutModeInserters() {
54
51
  sectionRootClientId: root,
55
52
  setInserterIsOpened: getSettings().__experimentalSetIsInserterOpened,
56
53
  selectedBlockClientId: getSelectedBlockClientId(),
57
- hoveredBlockClientId: getHoveredBlockClientId(),
58
- inserterSearchInputRef: getInserterSearchInputRef()
54
+ hoveredBlockClientId: getHoveredBlockClientId()
59
55
  };
60
56
  }, []);
61
57
  const {
@@ -104,7 +100,6 @@ function ZoomOutModeInserters() {
104
100
  showInsertionPoint(sectionRootClientId, index, {
105
101
  operation: 'insert'
106
102
  });
107
- inserterSearchInputRef?.current?.focus();
108
103
  }
109
104
  })]
110
105
  }, index);
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_element","_inbetween","_interopRequireDefault","_zoomOutModeInserterButton","_store","_lockUnlock","_jsxRuntime","ZoomOutModeInserters","isReady","setIsReady","useState","hasSelection","blockInsertionPoint","blockOrder","blockInsertionPointVisible","setInserterIsOpened","sectionRootClientId","selectedBlockClientId","hoveredBlockClientId","inserterSearchInputRef","useSelect","select","getSettings","getBlockInsertionPoint","getBlockOrder","getSelectionStart","getSelectedBlockClientId","getHoveredBlockClientId","isBlockInsertionPointVisible","getInserterSearchInputRef","unlock","blockEditorStore","root","clientId","__experimentalSetIsInserterOpened","showInsertionPoint","useDispatch","useEffect","timeout","setTimeout","clearTimeout","undefined","map","index","shouldRenderInsertionPoint","previousClientId","nextClientId","isSelected","isHovered","jsxs","default","children","jsx","style","borderRadius","height","opacity","transform","width","className","isVisible","onClick","rootClientId","insertionIndex","tab","category","operation","current","focus","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-tools/zoom-out-mode-inserters.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockPopoverInbetween from '../block-popover/inbetween';\nimport ZoomOutModeInserterButton from './zoom-out-mode-inserter-button';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nfunction ZoomOutModeInserters() {\n\tconst [ isReady, setIsReady ] = useState( false );\n\tconst {\n\t\thasSelection,\n\t\tblockInsertionPoint,\n\t\tblockOrder,\n\t\tblockInsertionPointVisible,\n\t\tsetInserterIsOpened,\n\t\tsectionRootClientId,\n\t\tselectedBlockClientId,\n\t\thoveredBlockClientId,\n\t\tinserterSearchInputRef,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetSettings,\n\t\t\tgetBlockInsertionPoint,\n\t\t\tgetBlockOrder,\n\t\t\tgetSelectionStart,\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetHoveredBlockClientId,\n\t\t\tisBlockInsertionPointVisible,\n\t\t\tgetInserterSearchInputRef,\n\t\t} = unlock( select( blockEditorStore ) );\n\n\t\tconst { sectionRootClientId: root } = unlock( getSettings() );\n\n\t\treturn {\n\t\t\thasSelection: !! getSelectionStart().clientId,\n\t\t\tblockInsertionPoint: getBlockInsertionPoint(),\n\t\t\tblockOrder: getBlockOrder( root ),\n\t\t\tblockInsertionPointVisible: isBlockInsertionPointVisible(),\n\t\t\tsectionRootClientId: root,\n\t\t\tsetInserterIsOpened:\n\t\t\t\tgetSettings().__experimentalSetIsInserterOpened,\n\t\t\tselectedBlockClientId: getSelectedBlockClientId(),\n\t\t\thoveredBlockClientId: getHoveredBlockClientId(),\n\t\t\tinserterSearchInputRef: getInserterSearchInputRef(),\n\t\t};\n\t}, [] );\n\n\tconst { showInsertionPoint } = useDispatch( blockEditorStore );\n\n\t// Defer the initial rendering to avoid the jumps due to the animation.\n\tuseEffect( () => {\n\t\tconst timeout = setTimeout( () => {\n\t\t\tsetIsReady( true );\n\t\t}, 500 );\n\t\treturn () => {\n\t\t\tclearTimeout( timeout );\n\t\t};\n\t}, [] );\n\n\tif ( ! isReady ) {\n\t\treturn null;\n\t}\n\n\treturn [ undefined, ...blockOrder ].map( ( clientId, index ) => {\n\t\tconst shouldRenderInsertionPoint =\n\t\t\tblockInsertionPointVisible && blockInsertionPoint.index === index;\n\n\t\tconst previousClientId = clientId;\n\t\tconst nextClientId = blockOrder[ index ];\n\n\t\tconst isSelected =\n\t\t\thasSelection &&\n\t\t\t( selectedBlockClientId === previousClientId ||\n\t\t\t\tselectedBlockClientId === nextClientId );\n\n\t\tconst isHovered =\n\t\t\thoveredBlockClientId === previousClientId ||\n\t\t\thoveredBlockClientId === nextClientId;\n\n\t\treturn (\n\t\t\t<BlockPopoverInbetween\n\t\t\t\tkey={ index }\n\t\t\t\tpreviousClientId={ previousClientId }\n\t\t\t\tnextClientId={ nextClientId }\n\t\t\t>\n\t\t\t\t{ shouldRenderInsertionPoint && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\tborderRadius: '0',\n\t\t\t\t\t\t\theight: '12px',\n\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\ttransform: 'translateY(-50%)',\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tclassName=\"block-editor-block-list__insertion-point-indicator\"\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! shouldRenderInsertionPoint && (\n\t\t\t\t\t<ZoomOutModeInserterButton\n\t\t\t\t\t\tisVisible={ isSelected || isHovered }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetInserterIsOpened( {\n\t\t\t\t\t\t\t\trootClientId: sectionRootClientId,\n\t\t\t\t\t\t\t\tinsertionIndex: index,\n\t\t\t\t\t\t\t\ttab: 'patterns',\n\t\t\t\t\t\t\t\tcategory: 'all',\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tshowInsertionPoint( sectionRootClientId, index, {\n\t\t\t\t\t\t\t\toperation: 'insert',\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tinserterSearchInputRef?.current?.focus();\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockPopoverInbetween>\n\t\t);\n\t} );\n}\n\nexport default ZoomOutModeInserters;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,0BAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAA2C,IAAAO,WAAA,GAAAP,OAAA;AAZ3C;AACA;AACA;;A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f9C,mBAAmB,CAAE;YACpB+C,YAAY,EAAE9C,mBAAmB;YACjC+C,cAAc,EAAEpB,KAAK;YACrBqB,GAAG,EAAE,UAAU;YACfC,QAAQ,EAAE;UACX,CAAE,CAAC;UACH9B,kBAAkB,CAAEnB,mBAAmB,EAAE2B,KAAK,EAAE;YAC/CuB,SAAS,EAAE;UACZ,CAAE,CAAC;UACH/C,sBAAsB,EAAEgD,OAAO,EAAEC,KAAK,CAAC,CAAC;QACzC;MAAG,CACH,CACD;IAAA,GAhCKzB,KAiCgB,CAAC;EAE1B,CAAE,CAAC;AACJ;AAAC,IAAA0B,QAAA,GAAAC,OAAA,CAAApB,OAAA,GAEc3C,oBAAoB","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_element","_inbetween","_interopRequireDefault","_zoomOutModeInserterButton","_store","_lockUnlock","_jsxRuntime","ZoomOutModeInserters","isReady","setIsReady","useState","hasSelection","blockInsertionPoint","blockOrder","blockInsertionPointVisible","setInserterIsOpened","sectionRootClientId","selectedBlockClientId","hoveredBlockClientId","useSelect","select","getSettings","getBlockInsertionPoint","getBlockOrder","getSelectionStart","getSelectedBlockClientId","getHoveredBlockClientId","isBlockInsertionPointVisible","getSectionRootClientId","unlock","blockEditorStore","root","clientId","__experimentalSetIsInserterOpened","showInsertionPoint","useDispatch","useEffect","timeout","setTimeout","clearTimeout","undefined","map","index","shouldRenderInsertionPoint","previousClientId","nextClientId","isSelected","isHovered","jsxs","default","children","jsx","style","borderRadius","height","opacity","transform","width","className","isVisible","onClick","rootClientId","insertionIndex","tab","category","operation","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-tools/zoom-out-mode-inserters.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockPopoverInbetween from '../block-popover/inbetween';\nimport ZoomOutModeInserterButton from './zoom-out-mode-inserter-button';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nfunction ZoomOutModeInserters() {\n\tconst [ isReady, setIsReady ] = useState( false );\n\tconst {\n\t\thasSelection,\n\t\tblockInsertionPoint,\n\t\tblockOrder,\n\t\tblockInsertionPointVisible,\n\t\tsetInserterIsOpened,\n\t\tsectionRootClientId,\n\t\tselectedBlockClientId,\n\t\thoveredBlockClientId,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetSettings,\n\t\t\tgetBlockInsertionPoint,\n\t\t\tgetBlockOrder,\n\t\t\tgetSelectionStart,\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetHoveredBlockClientId,\n\t\t\tisBlockInsertionPointVisible,\n\t\t\tgetSectionRootClientId,\n\t\t} = unlock( select( blockEditorStore ) );\n\n\t\tconst root = getSectionRootClientId();\n\n\t\treturn {\n\t\t\thasSelection: !! getSelectionStart().clientId,\n\t\t\tblockInsertionPoint: getBlockInsertionPoint(),\n\t\t\tblockOrder: getBlockOrder( root ),\n\t\t\tblockInsertionPointVisible: isBlockInsertionPointVisible(),\n\t\t\tsectionRootClientId: root,\n\t\t\tsetInserterIsOpened:\n\t\t\t\tgetSettings().__experimentalSetIsInserterOpened,\n\t\t\tselectedBlockClientId: getSelectedBlockClientId(),\n\t\t\thoveredBlockClientId: getHoveredBlockClientId(),\n\t\t};\n\t}, [] );\n\n\tconst { showInsertionPoint } = useDispatch( blockEditorStore );\n\n\t// Defer the initial rendering to avoid the jumps due to the animation.\n\tuseEffect( () => {\n\t\tconst timeout = setTimeout( () => {\n\t\t\tsetIsReady( true );\n\t\t}, 500 );\n\t\treturn () => {\n\t\t\tclearTimeout( timeout );\n\t\t};\n\t}, [] );\n\n\tif ( ! isReady ) {\n\t\treturn null;\n\t}\n\n\treturn [ undefined, ...blockOrder ].map( ( clientId, index ) => {\n\t\tconst shouldRenderInsertionPoint =\n\t\t\tblockInsertionPointVisible && blockInsertionPoint.index === index;\n\n\t\tconst previousClientId = clientId;\n\t\tconst nextClientId = blockOrder[ index ];\n\n\t\tconst isSelected =\n\t\t\thasSelection &&\n\t\t\t( selectedBlockClientId === previousClientId ||\n\t\t\t\tselectedBlockClientId === nextClientId );\n\n\t\tconst isHovered =\n\t\t\thoveredBlockClientId === previousClientId ||\n\t\t\thoveredBlockClientId === nextClientId;\n\n\t\treturn (\n\t\t\t<BlockPopoverInbetween\n\t\t\t\tkey={ index }\n\t\t\t\tpreviousClientId={ previousClientId }\n\t\t\t\tnextClientId={ nextClientId }\n\t\t\t>\n\t\t\t\t{ shouldRenderInsertionPoint && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\tborderRadius: '0',\n\t\t\t\t\t\t\theight: '12px',\n\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\ttransform: 'translateY(-50%)',\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tclassName=\"block-editor-block-list__insertion-point-indicator\"\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! shouldRenderInsertionPoint && (\n\t\t\t\t\t<ZoomOutModeInserterButton\n\t\t\t\t\t\tisVisible={ isSelected || isHovered }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetInserterIsOpened( {\n\t\t\t\t\t\t\t\trootClientId: sectionRootClientId,\n\t\t\t\t\t\t\t\tinsertionIndex: index,\n\t\t\t\t\t\t\t\ttab: 'patterns',\n\t\t\t\t\t\t\t\tcategory: 'all',\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tshowInsertionPoint( sectionRootClientId, index, {\n\t\t\t\t\t\t\t\toperation: 'insert',\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockPopoverInbetween>\n\t\t);\n\t} );\n}\n\nexport default ZoomOutModeInserters;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA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AAArC,WAAA,CAAA6C,GAAA,EAAChD,0BAAA,CAAA8C,OAAyB;QACzBU,SAAS,EAAGb,UAAU,IAAIC,SAAW;QACrCa,OAAO,EAAGA,CAAA,KAAM;UACf7C,mBAAmB,CAAE;YACpB8C,YAAY,EAAE7C,mBAAmB;YACjC8C,cAAc,EAAEpB,KAAK;YACrBqB,GAAG,EAAE,UAAU;YACfC,QAAQ,EAAE;UACX,CAAE,CAAC;UACH9B,kBAAkB,CAAElB,mBAAmB,EAAE0B,KAAK,EAAE;YAC/CuB,SAAS,EAAE;UACZ,CAAE,CAAC;QACJ;MAAG,CACH,CACD;IAAA,GA/BKvB,KAgCgB,CAAC;EAE1B,CAAE,CAAC;AACJ;AAAC,IAAAwB,QAAA,GAAAC,OAAA,CAAAlB,OAAA,GAEc1C,oBAAoB","ignoreList":[]}
@@ -26,8 +26,7 @@ function ZoomOutPopover({
26
26
  const {
27
27
  capturingClientId,
28
28
  isInsertionPointVisible,
29
- lastClientId,
30
- rootClientId
29
+ lastClientId
31
30
  } = (0, _useSelectedBlockToolProps.default)(clientId);
32
31
  const popoverProps = (0, _useBlockToolbarPopoverProps.default)({
33
32
  contentElement: __unstableContentRef?.current,
@@ -50,8 +49,8 @@ function ZoomOutPopover({
50
49
  resize: false,
51
50
  ...props,
52
51
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_zoomOutToolbar.default, {
53
- clientId: clientId,
54
- rootClientId: rootClientId
52
+ __unstableContentRef: __unstableContentRef,
53
+ clientId: clientId
55
54
  })
56
55
  });
57
56
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_blockPopover","_useBlockToolbarPopoverProps","_useSelectedBlockToolProps","_zoomOutToolbar","_jsxRuntime","ZoomOutPopover","clientId","__unstableContentRef","capturingClientId","isInsertionPointVisible","lastClientId","rootClientId","useSelectedBlockToolProps","popoverProps","useBlockToolbarPopoverProps","contentElement","current","props","placement","flip","shift","jsx","default","bottomClientId","className","clsx","resize","children"],"sources":["@wordpress/block-editor/src/components/block-tools/zoom-out-popover.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * Internal dependencies\n */\nimport BlockPopover from '../block-popover';\nimport useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';\nimport useSelectedBlockToolProps from './use-selected-block-tool-props';\nimport ZoomOutToolbar from './zoom-out-toolbar';\n\nexport default function ZoomOutPopover( { clientId, __unstableContentRef } ) {\n\tconst {\n\t\tcapturingClientId,\n\t\tisInsertionPointVisible,\n\t\tlastClientId,\n\t\trootClientId,\n\t} = useSelectedBlockToolProps( clientId );\n\n\tconst popoverProps = useBlockToolbarPopoverProps( {\n\t\tcontentElement: __unstableContentRef?.current,\n\t\tclientId,\n\t} );\n\n\t// Override some of the popover props for the zoom-out toolbar.\n\tconst props = {\n\t\t...popoverProps,\n\t\tplacement: 'left-start',\n\t\tflip: false,\n\t\tshift: true,\n\t};\n\n\treturn (\n\t\t<BlockPopover\n\t\t\tclientId={ capturingClientId || clientId }\n\t\t\tbottomClientId={ lastClientId }\n\t\t\tclassName={ clsx( 'zoom-out-toolbar-popover', {\n\t\t\t\t'is-insertion-point-visible': isInsertionPointVisible,\n\t\t\t} ) }\n\t\t\tresize={ false }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<ZoomOutToolbar\n\t\t\t\tclientId={ clientId }\n\t\t\t\trootClientId={ rootClientId }\n\t\t\t/>\n\t\t</BlockPopover>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,aAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,4BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,0BAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,eAAA,GAAAL,sBAAA,CAAAC,OAAA;AAAgD,IAAAK,WAAA,GAAAL,OAAA;AAVhD;AACA;AACA;;AAEA;AACA;AACA;;AAMe,SAASM,cAAcA,CAAE;EAAEC,QAAQ;EAAEC;AAAqB,CAAC,EAAG;EAC5E,MAAM;IACLC,iBAAiB;IACjBC,uBAAuB;IACvBC,YAAY;IACZC;EACD,CAAC,GAAG,IAAAC,kCAAyB,EAAEN,QAAS,CAAC;EAEzC,MAAMO,YAAY,GAAG,IAAAC,oCAA2B,EAAE;IACjDC,cAAc,EAAER,oBAAoB,EAAES,OAAO;IAC7CV;EACD,CAAE,CAAC;;EAEH;EACA,MAAMW,KAAK,GAAG;IACb,GAAGJ,YAAY;IACfK,SAAS,EAAE,YAAY;IACvBC,IAAI,EAAE,KAAK;IACXC,KAAK,EAAE;EACR,CAAC;EAED,oBACC,IAAAhB,WAAA,CAAAiB,GAAA,EAACrB,aAAA,CAAAsB,OAAY;IACZhB,QAAQ,EAAGE,iBAAiB,IAAIF,QAAU;IAC1CiB,cAAc,EAAGb,YAAc;IAC/Bc,SAAS,EAAG,IAAAC,aAAI,EAAE,0BAA0B,EAAE;MAC7C,4BAA4B,EAAEhB;IAC/B,CAAE,CAAG;IACLiB,MAAM,EAAG,KAAO;IAAA,GACXT,KAAK;IAAAU,QAAA,eAEV,IAAAvB,WAAA,CAAAiB,GAAA,EAAClB,eAAA,CAAAmB,OAAc;MACdhB,QAAQ,EAAGA,QAAU;MACrBK,YAAY,EAAGA;IAAc,CAC7B;EAAC,CACW,CAAC;AAEjB","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_blockPopover","_useBlockToolbarPopoverProps","_useSelectedBlockToolProps","_zoomOutToolbar","_jsxRuntime","ZoomOutPopover","clientId","__unstableContentRef","capturingClientId","isInsertionPointVisible","lastClientId","useSelectedBlockToolProps","popoverProps","useBlockToolbarPopoverProps","contentElement","current","props","placement","flip","shift","jsx","default","bottomClientId","className","clsx","resize","children"],"sources":["@wordpress/block-editor/src/components/block-tools/zoom-out-popover.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * Internal dependencies\n */\nimport BlockPopover from '../block-popover';\nimport useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';\nimport useSelectedBlockToolProps from './use-selected-block-tool-props';\nimport ZoomOutToolbar from './zoom-out-toolbar';\n\nexport default function ZoomOutPopover( { clientId, __unstableContentRef } ) {\n\tconst { capturingClientId, isInsertionPointVisible, lastClientId } =\n\t\tuseSelectedBlockToolProps( clientId );\n\n\tconst popoverProps = useBlockToolbarPopoverProps( {\n\t\tcontentElement: __unstableContentRef?.current,\n\t\tclientId,\n\t} );\n\n\t// Override some of the popover props for the zoom-out toolbar.\n\tconst props = {\n\t\t...popoverProps,\n\t\tplacement: 'left-start',\n\t\tflip: false,\n\t\tshift: true,\n\t};\n\n\treturn (\n\t\t<BlockPopover\n\t\t\tclientId={ capturingClientId || clientId }\n\t\t\tbottomClientId={ lastClientId }\n\t\t\tclassName={ clsx( 'zoom-out-toolbar-popover', {\n\t\t\t\t'is-insertion-point-visible': isInsertionPointVisible,\n\t\t\t} ) }\n\t\t\tresize={ false }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<ZoomOutToolbar\n\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\tclientId={ clientId }\n\t\t\t/>\n\t\t</BlockPopover>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,aAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,4BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,0BAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,eAAA,GAAAL,sBAAA,CAAAC,OAAA;AAAgD,IAAAK,WAAA,GAAAL,OAAA;AAVhD;AACA;AACA;;AAEA;AACA;AACA;;AAMe,SAASM,cAAcA,CAAE;EAAEC,QAAQ;EAAEC;AAAqB,CAAC,EAAG;EAC5E,MAAM;IAAEC,iBAAiB;IAAEC,uBAAuB;IAAEC;EAAa,CAA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