@wordpress/block-editor 14.4.0 → 14.6.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 (1056) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +4 -8
  3. package/build/autocompleters/block.js +13 -5
  4. package/build/autocompleters/block.js.map +1 -1
  5. package/build/components/background-image-control/index.js +1 -1
  6. package/build/components/background-image-control/index.js.map +1 -1
  7. package/build/components/block-canvas/index.js +10 -0
  8. package/build/components/block-canvas/index.js.map +1 -1
  9. package/build/components/block-card/index.js +2 -2
  10. package/build/components/block-card/index.js.map +1 -1
  11. package/build/components/block-controls/slot.js.map +1 -1
  12. package/build/components/block-controls/slot.native.js.map +1 -1
  13. package/build/components/block-draggable/draggable-chip.js +1 -1
  14. package/build/components/block-draggable/draggable-chip.js.map +1 -1
  15. package/build/components/block-full-height-alignment-control/index.js +1 -1
  16. package/build/components/block-full-height-alignment-control/index.js.map +1 -1
  17. package/build/components/block-list/block-invalid-warning.native.js +1 -1
  18. package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
  19. package/build/components/block-list/block-list-item.native.js.map +1 -1
  20. package/build/components/block-list/block.js +1 -1
  21. package/build/components/block-list/block.js.map +1 -1
  22. package/build/components/block-list/block.native.js +1 -7
  23. package/build/components/block-list/block.native.js.map +1 -1
  24. package/build/components/block-list/index.js +6 -5
  25. package/build/components/block-list/index.js.map +1 -1
  26. package/build/components/block-list/index.native.js.map +1 -1
  27. package/build/components/block-list/use-block-props/index.js +1 -2
  28. package/build/components/block-list/use-block-props/index.js.map +1 -1
  29. package/build/components/block-list/use-block-props/use-focus-first-element.js +4 -3
  30. package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  31. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +11 -6
  32. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  33. package/build/components/block-list/use-in-between-inserter.js +1 -1
  34. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  35. package/build/components/block-list/zoom-out-separator.js +10 -7
  36. package/build/components/block-list/zoom-out-separator.js.map +1 -1
  37. package/build/components/block-lock/modal.js +1 -1
  38. package/build/components/block-lock/modal.js.map +1 -1
  39. package/build/components/block-mover/button.js.map +1 -1
  40. package/build/components/block-parent-selector/index.js +1 -1
  41. package/build/components/block-parent-selector/index.js.map +1 -1
  42. package/build/components/block-pattern-setup/index.js.map +1 -1
  43. package/build/components/block-patterns-list/index.js.map +1 -1
  44. package/build/components/block-patterns-paging/index.js +1 -1
  45. package/build/components/block-patterns-paging/index.js.map +1 -1
  46. package/build/components/block-popover/index.js +1 -1
  47. package/build/components/block-popover/index.js.map +1 -1
  48. package/build/components/block-preview/auto.js +1 -4
  49. package/build/components/block-preview/auto.js.map +1 -1
  50. package/build/components/block-preview/index.js +2 -2
  51. package/build/components/block-preview/index.js.map +1 -1
  52. package/build/components/block-rename/modal.js +2 -2
  53. package/build/components/block-rename/modal.js.map +1 -1
  54. package/build/components/block-settings-menu/block-parent-selector-menu-item.js +1 -1
  55. package/build/components/block-settings-menu/block-parent-selector-menu-item.js.map +1 -1
  56. package/build/components/block-settings-menu/block-settings-dropdown.js +5 -0
  57. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  58. package/build/components/block-settings-menu/index.js +4 -3
  59. package/build/components/block-settings-menu/index.js.map +1 -1
  60. package/build/components/block-switcher/block-transformations-menu.native.js +1 -1
  61. package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
  62. package/build/components/block-switcher/index.js +2 -1
  63. package/build/components/block-switcher/index.js.map +1 -1
  64. package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  65. package/build/components/block-switcher/use-transformed-patterns.js +1 -0
  66. package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
  67. package/build/components/block-switcher/utils.js +1 -0
  68. package/build/components/block-switcher/utils.js.map +1 -1
  69. package/build/components/block-toolbar/change-design.js +122 -0
  70. package/build/components/block-toolbar/change-design.js.map +1 -0
  71. package/build/components/block-toolbar/index.js +19 -7
  72. package/build/components/block-toolbar/index.js.map +1 -1
  73. package/build/components/block-tools/index.js +4 -17
  74. package/build/components/block-tools/index.js.map +1 -1
  75. package/build/components/block-tools/insertion-point.js +4 -3
  76. package/build/components/block-tools/insertion-point.js.map +1 -1
  77. package/build/components/block-tools/use-show-block-tools.js +4 -6
  78. package/build/components/block-tools/use-show-block-tools.js.map +1 -1
  79. package/build/components/block-tools/zoom-out-mode-inserters.js +20 -29
  80. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  81. package/build/components/block-types-list/index.js.map +1 -1
  82. package/build/components/block-types-list/index.native.js.map +1 -1
  83. package/build/components/block-variation-transforms/index.js +3 -2
  84. package/build/components/block-variation-transforms/index.js.map +1 -1
  85. package/build/components/block-vertical-alignment-control/ui.js +6 -10
  86. package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
  87. package/build/components/border-radius-control/index.js.map +1 -1
  88. package/build/components/border-radius-control/linked-button.js +7 -10
  89. package/build/components/border-radius-control/linked-button.js.map +1 -1
  90. package/build/components/border-radius-control/utils.js.map +1 -1
  91. package/build/components/button-block-appender/index.js.map +1 -1
  92. package/build/components/collab/block-comment-icon-slot.js +18 -0
  93. package/build/components/collab/block-comment-icon-slot.js.map +1 -0
  94. package/build/components/collab/block-comment-icon-toolbar-slot.js +18 -0
  95. package/build/components/collab/block-comment-icon-toolbar-slot.js.map +1 -0
  96. package/build/components/color-style-selector/index.js.map +1 -1
  97. package/build/components/colors/utils.js.map +1 -1
  98. package/build/components/colors/with-colors.js.map +1 -1
  99. package/build/components/colors-gradients/panel-color-gradient-settings.native.js.map +1 -1
  100. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
  101. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  102. package/build/components/convert-to-group-buttons/toolbar.js +4 -4
  103. package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
  104. package/build/components/date-format-picker/index.js +1 -0
  105. package/build/components/date-format-picker/index.js.map +1 -1
  106. package/build/components/duotone/utils.js.map +1 -1
  107. package/build/components/duotone-control/index.js.map +1 -1
  108. package/build/components/font-sizes/fluid-utils.js.map +1 -1
  109. package/build/components/font-sizes/utils.js.map +1 -1
  110. package/build/components/font-sizes/with-font-sizes.js.map +1 -1
  111. package/build/components/global-styles/border-panel.js.map +1 -1
  112. package/build/components/global-styles/color-panel.js +1 -4
  113. package/build/components/global-styles/color-panel.js.map +1 -1
  114. package/build/components/global-styles/filters-panel.js.map +1 -1
  115. package/build/components/global-styles/get-block-css-selector.js.map +1 -1
  116. package/build/components/global-styles/get-global-styles-changes.js +2 -1
  117. package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
  118. package/build/components/global-styles/hooks.js.map +1 -1
  119. package/build/components/global-styles/typography-panel.js.map +1 -1
  120. package/build/components/global-styles/use-global-styles-context.native.js +6 -0
  121. package/build/components/global-styles/use-global-styles-context.native.js.map +1 -1
  122. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  123. package/build/components/global-styles/utils.js.map +1 -1
  124. package/build/components/gradients/use-gradient.js.map +1 -1
  125. package/build/components/grid/grid-item-movers.js.map +1 -1
  126. package/build/components/grid/grid-visualizer.js.map +1 -1
  127. package/build/components/iframe/index.js +46 -11
  128. package/build/components/iframe/index.js.map +1 -1
  129. package/build/components/image-editor/use-save-image.js +1 -1
  130. package/build/components/image-editor/use-save-image.js.map +1 -1
  131. package/build/components/image-size-control/index.js +61 -20
  132. package/build/components/image-size-control/index.js.map +1 -1
  133. package/build/components/inner-blocks/index.js +9 -5
  134. package/build/components/inner-blocks/index.js.map +1 -1
  135. package/build/components/inner-blocks/use-nested-settings-update.js +15 -8
  136. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  137. package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +1 -1
  138. package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
  139. package/build/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  140. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  141. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +2 -2
  142. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  143. package/build/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
  144. package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  145. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +1 -1
  146. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  147. package/build/components/inserter/block-types-tab.native.js.map +1 -1
  148. package/build/components/inserter/category-tabs/index.js +16 -12
  149. package/build/components/inserter/category-tabs/index.js.map +1 -1
  150. package/build/components/inserter/hooks/use-block-types-state.js +1 -1
  151. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  152. package/build/components/inserter/hooks/use-patterns-state.js +1 -1
  153. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  154. package/build/components/inserter/media-tab/media-panel.js.map +1 -1
  155. package/build/components/inserter/media-tab/media-preview.js +1 -1
  156. package/build/components/inserter/media-tab/media-preview.js.map +1 -1
  157. package/build/components/inserter/media-tab/media-tab.js.map +1 -1
  158. package/build/components/inserter/media-tab/utils.js.map +1 -1
  159. package/build/components/inserter/menu.js +8 -3
  160. package/build/components/inserter/menu.js.map +1 -1
  161. package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
  162. package/build/components/inserter/preview-panel.js.map +1 -1
  163. package/build/components/inserter/quick-inserter.js +1 -1
  164. package/build/components/inserter/quick-inserter.js.map +1 -1
  165. package/build/components/inserter/search-results.js +1 -1
  166. package/build/components/inserter/search-results.js.map +1 -1
  167. package/build/components/inserter/tabs.native.js.map +1 -1
  168. package/build/components/inserter-button/index.native.js +1 -1
  169. package/build/components/inserter-button/index.native.js.map +1 -1
  170. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  171. package/build/components/inspector-controls/fill.js.map +1 -1
  172. package/build/components/inspector-controls/fill.native.js.map +1 -1
  173. package/build/components/inspector-controls/slot.js.map +1 -1
  174. package/build/components/inspector-controls/slot.native.js.map +1 -1
  175. package/build/components/inspector-controls-tabs/index.js +0 -2
  176. package/build/components/inspector-controls-tabs/index.js.map +1 -1
  177. package/build/components/inspector-controls-tabs/utils.js +3 -6
  178. package/build/components/inspector-controls-tabs/utils.js.map +1 -1
  179. package/build/components/line-height-control/index.js.map +1 -1
  180. package/build/components/link-control/is-url-like.js.map +1 -1
  181. package/build/components/link-control/link-preview.js +12 -9
  182. package/build/components/link-control/link-preview.js.map +1 -1
  183. package/build/components/link-control/search-create-button.js +1 -1
  184. package/build/components/link-control/search-create-button.js.map +1 -1
  185. package/build/components/link-control/search-input.js +3 -5
  186. package/build/components/link-control/search-input.js.map +1 -1
  187. package/build/components/link-control/search-results.js +5 -15
  188. package/build/components/link-control/search-results.js.map +1 -1
  189. package/build/components/link-control/settings-drawer.js.map +1 -1
  190. package/build/components/link-control/use-rich-url-data.js.map +1 -1
  191. package/build/components/list-view/appender.js +5 -4
  192. package/build/components/list-view/appender.js.map +1 -1
  193. package/build/components/list-view/block-select-button.js.map +1 -1
  194. package/build/components/list-view/block.js.map +1 -1
  195. package/build/components/list-view/branch.js +6 -5
  196. package/build/components/list-view/branch.js.map +1 -1
  197. package/build/components/list-view/drop-indicator.js.map +1 -1
  198. package/build/components/list-view/index.js +1 -2
  199. package/build/components/list-view/index.js.map +1 -1
  200. package/build/components/list-view/use-block-selection.js +2 -2
  201. package/build/components/list-view/use-block-selection.js.map +1 -1
  202. package/build/components/list-view/utils.js +1 -1
  203. package/build/components/list-view/utils.js.map +1 -1
  204. package/build/components/media-placeholder/index.native.js +1 -1
  205. package/build/components/media-placeholder/index.native.js.map +1 -1
  206. package/build/components/media-replace-flow/index.js.map +1 -1
  207. package/build/components/multi-selection-inspector/index.js +2 -2
  208. package/build/components/multi-selection-inspector/index.js.map +1 -1
  209. package/build/components/observe-typing/index.js +1 -0
  210. package/build/components/observe-typing/index.js.map +1 -1
  211. package/build/components/provider/index.js +1 -1
  212. package/build/components/provider/index.js.map +1 -1
  213. package/build/components/recursion-provider/index.js +1 -0
  214. package/build/components/recursion-provider/index.js.map +1 -1
  215. package/build/components/responsive-block-control/index.js +3 -3
  216. package/build/components/responsive-block-control/index.js.map +1 -1
  217. package/build/components/responsive-block-control/label.js +1 -1
  218. package/build/components/responsive-block-control/label.js.map +1 -1
  219. package/build/components/rich-text/content.js.map +1 -1
  220. package/build/components/rich-text/event-listeners/index.js +3 -1
  221. package/build/components/rich-text/event-listeners/index.js.map +1 -1
  222. package/build/components/rich-text/file-paste-handler.native.js.map +1 -1
  223. package/build/components/rich-text/format-toolbar/index.js.map +1 -1
  224. package/build/components/rich-text/format-toolbar/index.native.js.map +1 -1
  225. package/build/components/rich-text/index.js +3 -2
  226. package/build/components/rich-text/index.js.map +1 -1
  227. package/build/components/rich-text/index.native.js +2 -6
  228. package/build/components/rich-text/index.native.js.map +1 -1
  229. package/build/components/rich-text/multiline.js.map +1 -1
  230. package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
  231. package/build/components/rich-text/native/index.native.js.map +1 -1
  232. package/build/components/rich-text/native/use-format-types.js +1 -0
  233. package/build/components/rich-text/native/use-format-types.js.map +1 -1
  234. package/build/components/rich-text/toolbar-button.js.map +1 -1
  235. package/build/components/rich-text/use-format-types.js +1 -0
  236. package/build/components/rich-text/use-format-types.js.map +1 -1
  237. package/build/components/spacing-sizes-control/index.js +2 -2
  238. package/build/components/spacing-sizes-control/index.js.map +1 -1
  239. package/build/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
  240. package/build/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
  241. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +3 -3
  242. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  243. package/build/components/spacing-sizes-control/linked-button.js +1 -5
  244. package/build/components/spacing-sizes-control/linked-button.js.map +1 -1
  245. package/build/components/spacing-sizes-control/utils.js +1 -0
  246. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  247. package/build/components/tool-selector/index.js +8 -5
  248. package/build/components/tool-selector/index.js.map +1 -1
  249. package/build/components/typewriter/index.js +1 -0
  250. package/build/components/typewriter/index.js.map +1 -1
  251. package/build/components/unsupported-block-details/index.native.js.map +1 -1
  252. package/build/components/url-input/index.js +1 -1
  253. package/build/components/url-input/index.js.map +1 -1
  254. package/build/components/use-block-commands/index.js +1 -1
  255. package/build/components/use-block-commands/index.js.map +1 -1
  256. package/build/components/use-block-drop-zone/index.js +5 -5
  257. package/build/components/use-block-drop-zone/index.js.map +1 -1
  258. package/build/components/use-block-drop-zone/index.native.js +0 -1
  259. package/build/components/use-block-drop-zone/index.native.js.map +1 -1
  260. package/build/components/use-flash-editable-blocks/index.js.map +1 -1
  261. package/build/components/use-moving-animation/index.js +1 -3
  262. package/build/components/use-moving-animation/index.js.map +1 -1
  263. package/build/components/use-resize-canvas/index.js +1 -2
  264. package/build/components/use-resize-canvas/index.js.map +1 -1
  265. package/build/components/use-settings/index.js +1 -3
  266. package/build/components/use-settings/index.js.map +1 -1
  267. package/build/components/writing-flow/index.js +5 -3
  268. package/build/components/writing-flow/index.js.map +1 -1
  269. package/build/components/writing-flow/use-tab-nav.js +20 -5
  270. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  271. package/build/hooks/align.js.map +1 -1
  272. package/build/hooks/block-bindings.js +19 -8
  273. package/build/hooks/block-bindings.js.map +1 -1
  274. package/build/hooks/block-hooks.js +1 -1
  275. package/build/hooks/block-hooks.js.map +1 -1
  276. package/build/hooks/block-style-variation.js.map +1 -1
  277. package/build/hooks/contrast-checker.js +0 -1
  278. package/build/hooks/contrast-checker.js.map +1 -1
  279. package/build/hooks/duotone.js +2 -2
  280. package/build/hooks/duotone.js.map +1 -1
  281. package/build/hooks/font-family.js.map +1 -1
  282. package/build/hooks/gap.js.map +1 -1
  283. package/build/hooks/generated-class-name.js +1 -0
  284. package/build/hooks/generated-class-name.js.map +1 -1
  285. package/build/hooks/grid-visualizer.js +13 -11
  286. package/build/hooks/grid-visualizer.js.map +1 -1
  287. package/build/hooks/layout-child.js +41 -3
  288. package/build/hooks/layout-child.js.map +1 -1
  289. package/build/hooks/layout.js.map +1 -1
  290. package/build/hooks/position.js +1 -1
  291. package/build/hooks/position.js.map +1 -1
  292. package/build/hooks/spacing-visualizer.js.map +1 -1
  293. package/build/hooks/style.js +4 -1
  294. package/build/hooks/style.js.map +1 -1
  295. package/build/hooks/text-align.js.map +1 -1
  296. package/build/hooks/use-typography-props.js.map +1 -1
  297. package/build/hooks/use-zoom-out.js +17 -18
  298. package/build/hooks/use-zoom-out.js.map +1 -1
  299. package/build/index.js +0 -7
  300. package/build/index.js.map +1 -1
  301. package/build/layouts/constrained.js.map +1 -1
  302. package/build/layouts/flex.js.map +1 -1
  303. package/build/layouts/grid.js.map +1 -1
  304. package/build/layouts/utils.js.map +1 -1
  305. package/build/private-apis.js +6 -1
  306. package/build/private-apis.js.map +1 -1
  307. package/build/store/actions.js +6 -38
  308. package/build/store/actions.js.map +1 -1
  309. package/build/store/defaults.js +1 -1
  310. package/build/store/defaults.js.map +1 -1
  311. package/build/store/private-actions.js +57 -8
  312. package/build/store/private-actions.js.map +1 -1
  313. package/build/store/private-selectors.js +9 -21
  314. package/build/store/private-selectors.js.map +1 -1
  315. package/build/store/reducer.js +18 -24
  316. package/build/store/reducer.js.map +1 -1
  317. package/build/store/selectors.js +66 -22
  318. package/build/store/selectors.js.map +1 -1
  319. package/build/utils/block-bindings.js +9 -6
  320. package/build/utils/block-bindings.js.map +1 -1
  321. package/build/utils/dom.js +16 -1
  322. package/build/utils/dom.js.map +1 -1
  323. package/build/utils/get-font-styles-and-weights.js +2 -2
  324. package/build/utils/get-font-styles-and-weights.js.map +1 -1
  325. package/build/utils/object.js +1 -0
  326. package/build/utils/object.js.map +1 -1
  327. package/build/utils/pasting.js.map +1 -1
  328. package/build/utils/transform-styles/index.js +4 -3
  329. package/build/utils/transform-styles/index.js.map +1 -1
  330. package/build-module/autocompleters/block.js +15 -9
  331. package/build-module/autocompleters/block.js.map +1 -1
  332. package/build-module/autocompleters/link.js +1 -3
  333. package/build-module/autocompleters/link.js.map +1 -1
  334. package/build-module/components/audio-player/index.native.js +1 -2
  335. package/build-module/components/audio-player/index.native.js.map +1 -1
  336. package/build-module/components/background-image-control/index.js +2 -3
  337. package/build-module/components/background-image-control/index.js.map +1 -1
  338. package/build-module/components/block-alignment-control/ui.js +1 -2
  339. package/build-module/components/block-alignment-control/ui.js.map +1 -1
  340. package/build-module/components/block-breadcrumb/index.js +1 -2
  341. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  342. package/build-module/components/block-canvas/index.js +12 -3
  343. package/build-module/components/block-canvas/index.js.map +1 -1
  344. package/build-module/components/block-card/index.js +4 -5
  345. package/build-module/components/block-card/index.js.map +1 -1
  346. package/build-module/components/block-compare/block-view.js +1 -2
  347. package/build-module/components/block-compare/block-view.js.map +1 -1
  348. package/build-module/components/block-compare/index.js +1 -2
  349. package/build-module/components/block-compare/index.js.map +1 -1
  350. package/build-module/components/block-controls/fill.js +1 -3
  351. package/build-module/components/block-controls/fill.js.map +1 -1
  352. package/build-module/components/block-controls/slot.js.map +1 -1
  353. package/build-module/components/block-controls/slot.native.js.map +1 -1
  354. package/build-module/components/block-draggable/draggable-chip.js +2 -3
  355. package/build-module/components/block-draggable/draggable-chip.js.map +1 -1
  356. package/build-module/components/block-draggable/draggable-chip.native.js +1 -2
  357. package/build-module/components/block-draggable/draggable-chip.native.js.map +1 -1
  358. package/build-module/components/block-draggable/index.native.js +1 -3
  359. package/build-module/components/block-draggable/index.native.js.map +1 -1
  360. package/build-module/components/block-edit/index.js +1 -2
  361. package/build-module/components/block-edit/index.js.map +1 -1
  362. package/build-module/components/block-edit/multiple-usage-warning.js +1 -2
  363. package/build-module/components/block-edit/multiple-usage-warning.js.map +1 -1
  364. package/build-module/components/block-full-height-alignment-control/index.js +1 -1
  365. package/build-module/components/block-full-height-alignment-control/index.js.map +1 -1
  366. package/build-module/components/block-inspector/index.js +1 -3
  367. package/build-module/components/block-inspector/index.js.map +1 -1
  368. package/build-module/components/block-list/block-crash-warning.js +1 -1
  369. package/build-module/components/block-list/block-crash-warning.js.map +1 -1
  370. package/build-module/components/block-list/block-crash-warning.native.js +1 -1
  371. package/build-module/components/block-list/block-crash-warning.native.js.map +1 -1
  372. package/build-module/components/block-list/block-invalid-warning.js +1 -3
  373. package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
  374. package/build-module/components/block-list/block-invalid-warning.native.js +1 -1
  375. package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
  376. package/build-module/components/block-list/block-list-item.native.js +1 -2
  377. package/build-module/components/block-list/block-list-item.native.js.map +1 -1
  378. package/build-module/components/block-list/block-selection-button.native.js +1 -2
  379. package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
  380. package/build-module/components/block-list/block.js +2 -4
  381. package/build-module/components/block-list/block.js.map +1 -1
  382. package/build-module/components/block-list/block.native.js +2 -9
  383. package/build-module/components/block-list/block.native.js.map +1 -1
  384. package/build-module/components/block-list/index.js +7 -7
  385. package/build-module/components/block-list/index.js.map +1 -1
  386. package/build-module/components/block-list/index.native.js +1 -3
  387. package/build-module/components/block-list/index.native.js.map +1 -1
  388. package/build-module/components/block-list/insertion-point.native.js +1 -2
  389. package/build-module/components/block-list/insertion-point.native.js.map +1 -1
  390. package/build-module/components/block-list/use-block-props/index.js +1 -2
  391. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  392. package/build-module/components/block-list/use-block-props/use-focus-first-element.js +4 -3
  393. package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  394. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +11 -6
  395. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  396. package/build-module/components/block-list/use-in-between-inserter.js +1 -1
  397. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  398. package/build-module/components/block-list/zoom-out-separator.js +10 -7
  399. package/build-module/components/block-list/zoom-out-separator.js.map +1 -1
  400. package/build-module/components/block-lock/menu-item.js +1 -3
  401. package/build-module/components/block-lock/menu-item.js.map +1 -1
  402. package/build-module/components/block-lock/modal.js +2 -3
  403. package/build-module/components/block-lock/modal.js.map +1 -1
  404. package/build-module/components/block-lock/toolbar.js +1 -3
  405. package/build-module/components/block-lock/toolbar.js.map +1 -1
  406. package/build-module/components/block-media-update-progress/index.native.js +1 -2
  407. package/build-module/components/block-media-update-progress/index.native.js.map +1 -1
  408. package/build-module/components/block-mover/button.js +1 -3
  409. package/build-module/components/block-mover/button.js.map +1 -1
  410. package/build-module/components/block-mover/index.js +1 -2
  411. package/build-module/components/block-mover/index.js.map +1 -1
  412. package/build-module/components/block-mover/index.native.js +1 -2
  413. package/build-module/components/block-mover/index.native.js.map +1 -1
  414. package/build-module/components/block-navigation/dropdown.js +1 -2
  415. package/build-module/components/block-navigation/dropdown.js.map +1 -1
  416. package/build-module/components/block-parent-selector/index.js +1 -1
  417. package/build-module/components/block-parent-selector/index.js.map +1 -1
  418. package/build-module/components/block-pattern-setup/index.js +1 -3
  419. package/build-module/components/block-pattern-setup/index.js.map +1 -1
  420. package/build-module/components/block-pattern-setup/setup-toolbar.js +1 -2
  421. package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
  422. package/build-module/components/block-patterns-list/index.js +1 -3
  423. package/build-module/components/block-patterns-list/index.js.map +1 -1
  424. package/build-module/components/block-patterns-paging/index.js +2 -3
  425. package/build-module/components/block-patterns-paging/index.js.map +1 -1
  426. package/build-module/components/block-popover/index.js +1 -1
  427. package/build-module/components/block-popover/index.js.map +1 -1
  428. package/build-module/components/block-preview/auto.js +2 -7
  429. package/build-module/components/block-preview/auto.js.map +1 -1
  430. package/build-module/components/block-preview/index.js +3 -4
  431. package/build-module/components/block-preview/index.js.map +1 -1
  432. package/build-module/components/block-quick-navigation/index.js +1 -2
  433. package/build-module/components/block-quick-navigation/index.js.map +1 -1
  434. package/build-module/components/block-removal-warning-modal/index.js +1 -2
  435. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  436. package/build-module/components/block-rename/modal.js +3 -4
  437. package/build-module/components/block-rename/modal.js.map +1 -1
  438. package/build-module/components/block-rename/rename-control.js +1 -3
  439. package/build-module/components/block-rename/rename-control.js.map +1 -1
  440. package/build-module/components/block-settings/container.native.js +1 -3
  441. package/build-module/components/block-settings/container.native.js.map +1 -1
  442. package/build-module/components/block-settings-menu/block-parent-selector-menu-item.js +1 -1
  443. package/build-module/components/block-settings-menu/block-parent-selector-menu-item.js.map +1 -1
  444. package/build-module/components/block-settings-menu/block-settings-dropdown.js +6 -3
  445. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  446. package/build-module/components/block-settings-menu/index.js +5 -4
  447. package/build-module/components/block-settings-menu/index.js.map +1 -1
  448. package/build-module/components/block-settings-menu-controls/index.js +1 -2
  449. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  450. package/build-module/components/block-styles/index.js +1 -2
  451. package/build-module/components/block-styles/index.js.map +1 -1
  452. package/build-module/components/block-styles/menu-items.js +1 -2
  453. package/build-module/components/block-styles/menu-items.js.map +1 -1
  454. package/build-module/components/block-styles/preview.native.js +1 -2
  455. package/build-module/components/block-styles/preview.native.js.map +1 -1
  456. package/build-module/components/block-switcher/block-transformations-menu.js +1 -3
  457. package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
  458. package/build-module/components/block-switcher/block-transformations-menu.native.js +1 -1
  459. package/build-module/components/block-switcher/block-transformations-menu.native.js.map +1 -1
  460. package/build-module/components/block-switcher/block-variation-transformations.js +1 -3
  461. package/build-module/components/block-switcher/block-variation-transformations.js.map +1 -1
  462. package/build-module/components/block-switcher/index.js +3 -4
  463. package/build-module/components/block-switcher/index.js.map +1 -1
  464. package/build-module/components/block-switcher/pattern-transformations-menu.js +1 -2
  465. package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  466. package/build-module/components/block-switcher/preview-block-popover.js +1 -2
  467. package/build-module/components/block-switcher/preview-block-popover.js.map +1 -1
  468. package/build-module/components/block-switcher/use-transformed-patterns.js +1 -0
  469. package/build-module/components/block-switcher/use-transformed-patterns.js.map +1 -1
  470. package/build-module/components/block-switcher/utils.js +1 -0
  471. package/build-module/components/block-switcher/utils.js.map +1 -1
  472. package/build-module/components/block-toolbar/block-toolbar-menu.native.js +1 -2
  473. package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
  474. package/build-module/components/block-toolbar/change-design.js +114 -0
  475. package/build-module/components/block-toolbar/change-design.js.map +1 -0
  476. package/build-module/components/block-toolbar/index.js +20 -10
  477. package/build-module/components/block-toolbar/index.js.map +1 -1
  478. package/build-module/components/block-toolbar/index.native.js +1 -3
  479. package/build-module/components/block-toolbar/index.native.js.map +1 -1
  480. package/build-module/components/block-tools/index.js +5 -19
  481. package/build-module/components/block-tools/index.js.map +1 -1
  482. package/build-module/components/block-tools/insertion-point.js +5 -5
  483. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  484. package/build-module/components/block-tools/use-show-block-tools.js +4 -6
  485. package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
  486. package/build-module/components/block-tools/zoom-out-mode-inserters.js +20 -29
  487. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  488. package/build-module/components/block-types-list/index.js +1 -2
  489. package/build-module/components/block-types-list/index.js.map +1 -1
  490. package/build-module/components/block-types-list/index.native.js +1 -2
  491. package/build-module/components/block-types-list/index.native.js.map +1 -1
  492. package/build-module/components/block-variation-picker/index.js +1 -2
  493. package/build-module/components/block-variation-picker/index.js.map +1 -1
  494. package/build-module/components/block-variation-picker/index.native.js +1 -2
  495. package/build-module/components/block-variation-picker/index.native.js.map +1 -1
  496. package/build-module/components/block-variation-transforms/index.js +4 -4
  497. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  498. package/build-module/components/block-vertical-alignment-control/ui.js +6 -10
  499. package/build-module/components/block-vertical-alignment-control/ui.js.map +1 -1
  500. package/build-module/components/border-radius-control/index.js +1 -3
  501. package/build-module/components/border-radius-control/index.js.map +1 -1
  502. package/build-module/components/border-radius-control/linked-button.js +8 -11
  503. package/build-module/components/border-radius-control/linked-button.js.map +1 -1
  504. package/build-module/components/border-radius-control/utils.js.map +1 -1
  505. package/build-module/components/button-block-appender/index.js.map +1 -1
  506. package/build-module/components/button-block-appender/index.native.js +1 -2
  507. package/build-module/components/button-block-appender/index.native.js.map +1 -1
  508. package/build-module/components/child-layout-control/index.js +1 -3
  509. package/build-module/components/child-layout-control/index.js.map +1 -1
  510. package/build-module/components/collab/block-comment-icon-slot.js +11 -0
  511. package/build-module/components/collab/block-comment-icon-slot.js.map +1 -0
  512. package/build-module/components/collab/block-comment-icon-toolbar-slot.js +11 -0
  513. package/build-module/components/collab/block-comment-icon-toolbar-slot.js.map +1 -0
  514. package/build-module/components/color-style-selector/index.js.map +1 -1
  515. package/build-module/components/colors/utils.js.map +1 -1
  516. package/build-module/components/colors/with-colors.js.map +1 -1
  517. package/build-module/components/colors-gradients/control.js +1 -2
  518. package/build-module/components/colors-gradients/control.js.map +1 -1
  519. package/build-module/components/colors-gradients/dropdown.js +1 -3
  520. package/build-module/components/colors-gradients/dropdown.js.map +1 -1
  521. package/build-module/components/colors-gradients/panel-color-gradient-settings.js +1 -3
  522. package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  523. package/build-module/components/colors-gradients/panel-color-gradient-settings.native.js +1 -3
  524. package/build-module/components/colors-gradients/panel-color-gradient-settings.native.js.map +1 -1
  525. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
  526. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  527. package/build-module/components/contrast-checker/index.native.js +1 -2
  528. package/build-module/components/contrast-checker/index.native.js.map +1 -1
  529. package/build-module/components/convert-to-group-buttons/index.js +1 -3
  530. package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
  531. package/build-module/components/convert-to-group-buttons/toolbar.js +5 -6
  532. package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
  533. package/build-module/components/date-format-picker/index.js +2 -2
  534. package/build-module/components/date-format-picker/index.js.map +1 -1
  535. package/build-module/components/default-block-appender/index.js +1 -2
  536. package/build-module/components/default-block-appender/index.js.map +1 -1
  537. package/build-module/components/dimensions-tool/index.js +1 -3
  538. package/build-module/components/dimensions-tool/index.js.map +1 -1
  539. package/build-module/components/dimensions-tool/width-height-tool.js +1 -3
  540. package/build-module/components/dimensions-tool/width-height-tool.js.map +1 -1
  541. package/build-module/components/duotone/utils.js.map +1 -1
  542. package/build-module/components/duotone-control/index.js +1 -2
  543. package/build-module/components/duotone-control/index.js.map +1 -1
  544. package/build-module/components/editor-styles/index.js +1 -3
  545. package/build-module/components/editor-styles/index.js.map +1 -1
  546. package/build-module/components/floating-toolbar/index.native.js +1 -2
  547. package/build-module/components/floating-toolbar/index.native.js.map +1 -1
  548. package/build-module/components/floating-toolbar/nav-up-icon.js +1 -2
  549. package/build-module/components/floating-toolbar/nav-up-icon.js.map +1 -1
  550. package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
  551. package/build-module/components/font-sizes/utils.js.map +1 -1
  552. package/build-module/components/font-sizes/with-font-sizes.js +2 -2
  553. package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
  554. package/build-module/components/global-styles/advanced-panel.js +1 -2
  555. package/build-module/components/global-styles/advanced-panel.js.map +1 -1
  556. package/build-module/components/global-styles/border-panel.js +1 -2
  557. package/build-module/components/global-styles/border-panel.js.map +1 -1
  558. package/build-module/components/global-styles/color-panel.js +3 -7
  559. package/build-module/components/global-styles/color-panel.js.map +1 -1
  560. package/build-module/components/global-styles/dimensions-panel.js +1 -2
  561. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  562. package/build-module/components/global-styles/filters-panel.js +1 -2
  563. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  564. package/build-module/components/global-styles/get-block-css-selector.js.map +1 -1
  565. package/build-module/components/global-styles/get-global-styles-changes.js +2 -1
  566. package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
  567. package/build-module/components/global-styles/hooks.js.map +1 -1
  568. package/build-module/components/global-styles/image-settings-panel.js +1 -2
  569. package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
  570. package/build-module/components/global-styles/shadow-panel-components.js +1 -2
  571. package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
  572. package/build-module/components/global-styles/typography-panel.js +1 -2
  573. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  574. package/build-module/components/global-styles/use-global-styles-context.native.js +6 -0
  575. package/build-module/components/global-styles/use-global-styles-context.native.js.map +1 -1
  576. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  577. package/build-module/components/global-styles/utils.js.map +1 -1
  578. package/build-module/components/gradients/use-gradient.js.map +1 -1
  579. package/build-module/components/grid/grid-item-movers.js +1 -3
  580. package/build-module/components/grid/grid-item-movers.js.map +1 -1
  581. package/build-module/components/grid/grid-visualizer.js.map +1 -1
  582. package/build-module/components/height-control/index.js +1 -2
  583. package/build-module/components/height-control/index.js.map +1 -1
  584. package/build-module/components/iframe/index.js +47 -14
  585. package/build-module/components/iframe/index.js.map +1 -1
  586. package/build-module/components/image-editor/aspect-ratio-dropdown.js +1 -3
  587. package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  588. package/build-module/components/image-editor/cropper.js +1 -3
  589. package/build-module/components/image-editor/cropper.js.map +1 -1
  590. package/build-module/components/image-editor/form-controls.js +1 -3
  591. package/build-module/components/image-editor/form-controls.js.map +1 -1
  592. package/build-module/components/image-editor/index.js +1 -2
  593. package/build-module/components/image-editor/index.js.map +1 -1
  594. package/build-module/components/image-editor/use-save-image.js +1 -1
  595. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  596. package/build-module/components/image-link-destinations/index.native.js +1 -3
  597. package/build-module/components/image-link-destinations/index.native.js.map +1 -1
  598. package/build-module/components/image-size-control/index.js +63 -24
  599. package/build-module/components/image-size-control/index.js.map +1 -1
  600. package/build-module/components/inner-blocks/index.js +9 -5
  601. package/build-module/components/inner-blocks/index.js.map +1 -1
  602. package/build-module/components/inner-blocks/use-nested-settings-update.js +16 -9
  603. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  604. package/build-module/components/inner-blocks/warning-max-depth-exceeded.native.js +1 -2
  605. package/build-module/components/inner-blocks/warning-max-depth-exceeded.native.js.map +1 -1
  606. package/build-module/components/inserter/block-patterns-explorer/index.js +1 -2
  607. package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -1
  608. package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +2 -3
  609. package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
  610. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +3 -5
  611. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  612. package/build-module/components/inserter/block-patterns-tab/index.js +1 -3
  613. package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
  614. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +3 -5
  615. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  616. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +2 -4
  617. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  618. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +1 -1
  619. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  620. package/build-module/components/inserter/block-types-tab.js +1 -3
  621. package/build-module/components/inserter/block-types-tab.js.map +1 -1
  622. package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
  623. package/build-module/components/inserter/category-tabs/index.js +18 -15
  624. package/build-module/components/inserter/category-tabs/index.js.map +1 -1
  625. package/build-module/components/inserter/hooks/use-block-types-state.js +1 -1
  626. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  627. package/build-module/components/inserter/hooks/use-patterns-state.js +1 -1
  628. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  629. package/build-module/components/inserter/index.native.js +1 -3
  630. package/build-module/components/inserter/index.native.js.map +1 -1
  631. package/build-module/components/inserter/media-tab/media-panel.js +1 -2
  632. package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
  633. package/build-module/components/inserter/media-tab/media-preview.js +2 -4
  634. package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
  635. package/build-module/components/inserter/media-tab/media-tab.js +1 -3
  636. package/build-module/components/inserter/media-tab/media-tab.js.map +1 -1
  637. package/build-module/components/inserter/media-tab/utils.js.map +1 -1
  638. package/build-module/components/inserter/menu.js +10 -7
  639. package/build-module/components/inserter/menu.js.map +1 -1
  640. package/build-module/components/inserter/menu.native.js +1 -3
  641. package/build-module/components/inserter/menu.native.js.map +1 -1
  642. package/build-module/components/inserter/mobile-tab-navigation.js +1 -2
  643. package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
  644. package/build-module/components/inserter/no-results.js +1 -2
  645. package/build-module/components/inserter/no-results.js.map +1 -1
  646. package/build-module/components/inserter/no-results.native.js +1 -2
  647. package/build-module/components/inserter/no-results.native.js.map +1 -1
  648. package/build-module/components/inserter/panel.js +1 -3
  649. package/build-module/components/inserter/panel.js.map +1 -1
  650. package/build-module/components/inserter/preview-panel.js +1 -2
  651. package/build-module/components/inserter/preview-panel.js.map +1 -1
  652. package/build-module/components/inserter/quick-inserter.js +2 -3
  653. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  654. package/build-module/components/inserter/search-results.js +2 -3
  655. package/build-module/components/inserter/search-results.js.map +1 -1
  656. package/build-module/components/inserter/tabs.native.js.map +1 -1
  657. package/build-module/components/inserter-button/index.native.js +2 -3
  658. package/build-module/components/inserter-button/index.native.js.map +1 -1
  659. package/build-module/components/inserter-list-item/index.js +1 -2
  660. package/build-module/components/inserter-list-item/index.js.map +1 -1
  661. package/build-module/components/inserter-listbox/index.js +1 -2
  662. package/build-module/components/inserter-listbox/index.js.map +1 -1
  663. package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  664. package/build-module/components/inspector-controls/fill.js.map +1 -1
  665. package/build-module/components/inspector-controls/fill.native.js +1 -3
  666. package/build-module/components/inspector-controls/fill.native.js.map +1 -1
  667. package/build-module/components/inspector-controls/slot.js.map +1 -1
  668. package/build-module/components/inspector-controls/slot.native.js.map +1 -1
  669. package/build-module/components/inspector-controls-tabs/index.js +1 -4
  670. package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
  671. package/build-module/components/inspector-controls-tabs/settings-tab.js +1 -3
  672. package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -1
  673. package/build-module/components/inspector-controls-tabs/styles-tab.js +1 -3
  674. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  675. package/build-module/components/inspector-controls-tabs/utils.js +3 -6
  676. package/build-module/components/inspector-controls-tabs/utils.js.map +1 -1
  677. package/build-module/components/inspector-popover-header/index.js +1 -2
  678. package/build-module/components/inspector-popover-header/index.js.map +1 -1
  679. package/build-module/components/line-height-control/index.js.map +1 -1
  680. package/build-module/components/link-control/index.js +1 -3
  681. package/build-module/components/link-control/index.js.map +1 -1
  682. package/build-module/components/link-control/is-url-like.js.map +1 -1
  683. package/build-module/components/link-control/link-preview.js +14 -13
  684. package/build-module/components/link-control/link-preview.js.map +1 -1
  685. package/build-module/components/link-control/search-create-button.js +1 -1
  686. package/build-module/components/link-control/search-create-button.js.map +1 -1
  687. package/build-module/components/link-control/search-input.js +4 -7
  688. package/build-module/components/link-control/search-input.js.map +1 -1
  689. package/build-module/components/link-control/search-results.js +6 -17
  690. package/build-module/components/link-control/search-results.js.map +1 -1
  691. package/build-module/components/link-control/settings-drawer.js +1 -3
  692. package/build-module/components/link-control/settings-drawer.js.map +1 -1
  693. package/build-module/components/link-control/settings.js +1 -2
  694. package/build-module/components/link-control/settings.js.map +1 -1
  695. package/build-module/components/link-control/use-rich-url-data.js.map +1 -1
  696. package/build-module/components/list-view/appender.js +6 -6
  697. package/build-module/components/list-view/appender.js.map +1 -1
  698. package/build-module/components/list-view/block-contents.js +1 -3
  699. package/build-module/components/list-view/block-contents.js.map +1 -1
  700. package/build-module/components/list-view/block-select-button.js +1 -2
  701. package/build-module/components/list-view/block-select-button.js.map +1 -1
  702. package/build-module/components/list-view/block.js +1 -3
  703. package/build-module/components/list-view/block.js.map +1 -1
  704. package/build-module/components/list-view/branch.js +8 -9
  705. package/build-module/components/list-view/branch.js.map +1 -1
  706. package/build-module/components/list-view/drop-indicator.js +1 -2
  707. package/build-module/components/list-view/drop-indicator.js.map +1 -1
  708. package/build-module/components/list-view/index.js +2 -4
  709. package/build-module/components/list-view/index.js.map +1 -1
  710. package/build-module/components/list-view/use-block-selection.js +2 -2
  711. package/build-module/components/list-view/use-block-selection.js.map +1 -1
  712. package/build-module/components/list-view/utils.js +1 -1
  713. package/build-module/components/list-view/utils.js.map +1 -1
  714. package/build-module/components/media-placeholder/index.js +1 -3
  715. package/build-module/components/media-placeholder/index.js.map +1 -1
  716. package/build-module/components/media-placeholder/index.native.js +2 -4
  717. package/build-module/components/media-placeholder/index.native.js.map +1 -1
  718. package/build-module/components/media-replace-flow/index.js +1 -3
  719. package/build-module/components/media-replace-flow/index.js.map +1 -1
  720. package/build-module/components/media-upload/index.native.js +1 -3
  721. package/build-module/components/media-upload/index.native.js.map +1 -1
  722. package/build-module/components/media-upload-progress/index.native.js +1 -2
  723. package/build-module/components/media-upload-progress/index.native.js.map +1 -1
  724. package/build-module/components/multi-selection-inspector/index.js +3 -4
  725. package/build-module/components/multi-selection-inspector/index.js.map +1 -1
  726. package/build-module/components/observe-typing/index.js +1 -0
  727. package/build-module/components/observe-typing/index.js.map +1 -1
  728. package/build-module/components/provider/index.js +2 -3
  729. package/build-module/components/provider/index.js.map +1 -1
  730. package/build-module/components/publish-date-time-picker/index.js +1 -2
  731. package/build-module/components/publish-date-time-picker/index.js.map +1 -1
  732. package/build-module/components/recursion-provider/index.js +1 -0
  733. package/build-module/components/recursion-provider/index.js.map +1 -1
  734. package/build-module/components/responsive-block-control/index.js +4 -5
  735. package/build-module/components/responsive-block-control/index.js.map +1 -1
  736. package/build-module/components/responsive-block-control/label.js +2 -4
  737. package/build-module/components/responsive-block-control/label.js.map +1 -1
  738. package/build-module/components/rich-text/content.js.map +1 -1
  739. package/build-module/components/rich-text/event-listeners/before-input-rules.js +2 -2
  740. package/build-module/components/rich-text/event-listeners/before-input-rules.js.map +1 -1
  741. package/build-module/components/rich-text/event-listeners/delete.js +2 -2
  742. package/build-module/components/rich-text/event-listeners/delete.js.map +1 -1
  743. package/build-module/components/rich-text/event-listeners/enter.js +2 -2
  744. package/build-module/components/rich-text/event-listeners/enter.js.map +1 -1
  745. package/build-module/components/rich-text/event-listeners/firefox-compat.js +2 -2
  746. package/build-module/components/rich-text/event-listeners/firefox-compat.js.map +1 -1
  747. package/build-module/components/rich-text/event-listeners/index.js +4 -2
  748. package/build-module/components/rich-text/event-listeners/index.js.map +1 -1
  749. package/build-module/components/rich-text/event-listeners/input-events.js +2 -2
  750. package/build-module/components/rich-text/event-listeners/input-events.js.map +1 -1
  751. package/build-module/components/rich-text/event-listeners/input-rules.js +2 -2
  752. package/build-module/components/rich-text/event-listeners/input-rules.js.map +1 -1
  753. package/build-module/components/rich-text/event-listeners/insert-replacement-text.js +2 -2
  754. package/build-module/components/rich-text/event-listeners/insert-replacement-text.js.map +1 -1
  755. package/build-module/components/rich-text/event-listeners/paste-handler.js +2 -2
  756. package/build-module/components/rich-text/event-listeners/paste-handler.js.map +1 -1
  757. package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.js +2 -2
  758. package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.js.map +1 -1
  759. package/build-module/components/rich-text/event-listeners/shortcuts.js +2 -2
  760. package/build-module/components/rich-text/event-listeners/shortcuts.js.map +1 -1
  761. package/build-module/components/rich-text/event-listeners/undo-automatic-change.js +2 -2
  762. package/build-module/components/rich-text/event-listeners/undo-automatic-change.js.map +1 -1
  763. package/build-module/components/rich-text/file-paste-handler.native.js.map +1 -1
  764. package/build-module/components/rich-text/format-toolbar/index.js +1 -3
  765. package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
  766. package/build-module/components/rich-text/format-toolbar/index.native.js +1 -3
  767. package/build-module/components/rich-text/format-toolbar/index.native.js.map +1 -1
  768. package/build-module/components/rich-text/index.js +4 -5
  769. package/build-module/components/rich-text/index.js.map +1 -1
  770. package/build-module/components/rich-text/index.native.js +3 -9
  771. package/build-module/components/rich-text/index.native.js.map +1 -1
  772. package/build-module/components/rich-text/multiline.js.map +1 -1
  773. package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
  774. package/build-module/components/rich-text/native/index.js +1 -1
  775. package/build-module/components/rich-text/native/index.js.map +1 -1
  776. package/build-module/components/rich-text/native/index.native.js +1 -3
  777. package/build-module/components/rich-text/native/index.native.js.map +1 -1
  778. package/build-module/components/rich-text/native/toolbar-button-with-options.native.js +1 -3
  779. package/build-module/components/rich-text/native/toolbar-button-with-options.native.js.map +1 -1
  780. package/build-module/components/rich-text/native/use-format-types.js +1 -0
  781. package/build-module/components/rich-text/native/use-format-types.js.map +1 -1
  782. package/build-module/components/rich-text/toolbar-button.js.map +1 -1
  783. package/build-module/components/rich-text/use-format-types.js +1 -0
  784. package/build-module/components/rich-text/use-format-types.js.map +1 -1
  785. package/build-module/components/spacing-sizes-control/index.js +4 -5
  786. package/build-module/components/spacing-sizes-control/index.js.map +1 -1
  787. package/build-module/components/spacing-sizes-control/input-controls/axial.js +1 -2
  788. package/build-module/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
  789. package/build-module/components/spacing-sizes-control/input-controls/separated.js +1 -2
  790. package/build-module/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
  791. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +5 -7
  792. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  793. package/build-module/components/spacing-sizes-control/linked-button.js +2 -6
  794. package/build-module/components/spacing-sizes-control/linked-button.js.map +1 -1
  795. package/build-module/components/spacing-sizes-control/utils.js +1 -0
  796. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  797. package/build-module/components/tabbed-sidebar/index.js +1 -2
  798. package/build-module/components/tabbed-sidebar/index.js.map +1 -1
  799. package/build-module/components/tool-selector/index.js +9 -8
  800. package/build-module/components/tool-selector/index.js.map +1 -1
  801. package/build-module/components/typewriter/index.js +1 -0
  802. package/build-module/components/typewriter/index.js.map +1 -1
  803. package/build-module/components/unsupported-block-details/index.native.js +1 -2
  804. package/build-module/components/unsupported-block-details/index.native.js.map +1 -1
  805. package/build-module/components/url-input/button.js +1 -2
  806. package/build-module/components/url-input/button.js.map +1 -1
  807. package/build-module/components/url-input/index.js +2 -4
  808. package/build-module/components/url-input/index.js.map +1 -1
  809. package/build-module/components/url-popover/image-url-input-ui.js +1 -3
  810. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  811. package/build-module/components/url-popover/index.js +1 -2
  812. package/build-module/components/url-popover/index.js.map +1 -1
  813. package/build-module/components/url-popover/link-editor.js +1 -2
  814. package/build-module/components/url-popover/link-editor.js.map +1 -1
  815. package/build-module/components/url-popover/link-viewer.js +1 -2
  816. package/build-module/components/url-popover/link-viewer.js.map +1 -1
  817. package/build-module/components/use-block-commands/index.js +1 -1
  818. package/build-module/components/use-block-commands/index.js.map +1 -1
  819. package/build-module/components/use-block-drop-zone/index.js +5 -5
  820. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  821. package/build-module/components/use-block-drop-zone/index.native.js +0 -1
  822. package/build-module/components/use-block-drop-zone/index.native.js.map +1 -1
  823. package/build-module/components/use-flash-editable-blocks/index.js.map +1 -1
  824. package/build-module/components/use-moving-animation/index.js +1 -3
  825. package/build-module/components/use-moving-animation/index.js.map +1 -1
  826. package/build-module/components/use-resize-canvas/index.js +1 -2
  827. package/build-module/components/use-resize-canvas/index.js.map +1 -1
  828. package/build-module/components/use-settings/index.js +1 -3
  829. package/build-module/components/use-settings/index.js.map +1 -1
  830. package/build-module/components/video-player/index.native.js +1 -2
  831. package/build-module/components/video-player/index.native.js.map +1 -1
  832. package/build-module/components/warning/index.js +1 -2
  833. package/build-module/components/warning/index.js.map +1 -1
  834. package/build-module/components/warning/index.native.js +1 -2
  835. package/build-module/components/warning/index.native.js.map +1 -1
  836. package/build-module/components/writing-flow/index.js +6 -6
  837. package/build-module/components/writing-flow/index.js.map +1 -1
  838. package/build-module/components/writing-flow/use-tab-nav.js +20 -5
  839. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  840. package/build-module/hooks/align.js.map +1 -1
  841. package/build-module/hooks/anchor.js +1 -3
  842. package/build-module/hooks/anchor.js.map +1 -1
  843. package/build-module/hooks/block-bindings.js +21 -12
  844. package/build-module/hooks/block-bindings.js.map +1 -1
  845. package/build-module/hooks/block-hooks.js +2 -3
  846. package/build-module/hooks/block-hooks.js.map +1 -1
  847. package/build-module/hooks/block-style-variation.js +1 -2
  848. package/build-module/hooks/block-style-variation.js.map +1 -1
  849. package/build-module/hooks/contrast-checker.js +0 -1
  850. package/build-module/hooks/contrast-checker.js.map +1 -1
  851. package/build-module/hooks/dimensions.js +1 -3
  852. package/build-module/hooks/dimensions.js.map +1 -1
  853. package/build-module/hooks/duotone.js +3 -5
  854. package/build-module/hooks/duotone.js.map +1 -1
  855. package/build-module/hooks/font-family.js.map +1 -1
  856. package/build-module/hooks/gap.js.map +1 -1
  857. package/build-module/hooks/generated-class-name.js +1 -0
  858. package/build-module/hooks/generated-class-name.js.map +1 -1
  859. package/build-module/hooks/grid-visualizer.js +14 -14
  860. package/build-module/hooks/grid-visualizer.js.map +1 -1
  861. package/build-module/hooks/layout-child.js +42 -6
  862. package/build-module/hooks/layout-child.js.map +1 -1
  863. package/build-module/hooks/layout.js +1 -3
  864. package/build-module/hooks/layout.js.map +1 -1
  865. package/build-module/hooks/position.js +1 -1
  866. package/build-module/hooks/position.js.map +1 -1
  867. package/build-module/hooks/spacing-visualizer.js.map +1 -1
  868. package/build-module/hooks/style.js +5 -4
  869. package/build-module/hooks/style.js.map +1 -1
  870. package/build-module/hooks/text-align.js.map +1 -1
  871. package/build-module/hooks/typography.native.js +1 -2
  872. package/build-module/hooks/typography.native.js.map +1 -1
  873. package/build-module/hooks/use-bindings-attributes.js +1 -2
  874. package/build-module/hooks/use-bindings-attributes.js.map +1 -1
  875. package/build-module/hooks/use-typography-props.js.map +1 -1
  876. package/build-module/hooks/use-zoom-out.js +18 -19
  877. package/build-module/hooks/use-zoom-out.js.map +1 -1
  878. package/build-module/index.js +1 -1
  879. package/build-module/index.js.map +1 -1
  880. package/build-module/layouts/constrained.js +1 -3
  881. package/build-module/layouts/constrained.js.map +1 -1
  882. package/build-module/layouts/flex.js +1 -3
  883. package/build-module/layouts/flex.js.map +1 -1
  884. package/build-module/layouts/grid.js +1 -3
  885. package/build-module/layouts/grid.js.map +1 -1
  886. package/build-module/layouts/utils.js.map +1 -1
  887. package/build-module/private-apis.js +7 -3
  888. package/build-module/private-apis.js.map +1 -1
  889. package/build-module/store/actions.js +6 -38
  890. package/build-module/store/actions.js.map +1 -1
  891. package/build-module/store/defaults.js +1 -1
  892. package/build-module/store/defaults.js.map +1 -1
  893. package/build-module/store/private-actions.js +54 -7
  894. package/build-module/store/private-actions.js.map +1 -1
  895. package/build-module/store/private-selectors.js +9 -20
  896. package/build-module/store/private-selectors.js.map +1 -1
  897. package/build-module/store/reducer.js +17 -22
  898. package/build-module/store/reducer.js.map +1 -1
  899. package/build-module/store/selectors.js +66 -20
  900. package/build-module/store/selectors.js.map +1 -1
  901. package/build-module/utils/block-bindings.js +9 -6
  902. package/build-module/utils/block-bindings.js.map +1 -1
  903. package/build-module/utils/dom.js +16 -1
  904. package/build-module/utils/dom.js.map +1 -1
  905. package/build-module/utils/get-font-styles-and-weights.js +3 -3
  906. package/build-module/utils/get-font-styles-and-weights.js.map +1 -1
  907. package/build-module/utils/get-px-from-css-unit.js +1 -1
  908. package/build-module/utils/get-px-from-css-unit.js.map +1 -1
  909. package/build-module/utils/object.js +1 -0
  910. package/build-module/utils/object.js.map +1 -1
  911. package/build-module/utils/pasting.js.map +1 -1
  912. package/build-module/utils/transform-styles/index.js +3 -2
  913. package/build-module/utils/transform-styles/index.js.map +1 -1
  914. package/build-style/content-rtl.css +19 -27
  915. package/build-style/content.css +19 -27
  916. package/build-style/style-rtl.css +47 -54
  917. package/build-style/style.css +47 -54
  918. package/build-types/utils/dom.d.ts.map +1 -1
  919. package/package.json +34 -33
  920. package/src/autocompleters/block.js +16 -7
  921. package/src/components/block-canvas/index.js +17 -1
  922. package/src/components/block-canvas/style.scss +1 -0
  923. package/src/components/block-card/index.js +3 -3
  924. package/src/components/block-full-height-alignment-control/index.js +1 -1
  925. package/src/components/block-inspector/style.scss +0 -6
  926. package/src/components/block-list/block.js +1 -2
  927. package/src/components/block-list/block.native.js +0 -4
  928. package/src/components/block-list/content.scss +4 -3
  929. package/src/components/block-list/index.js +4 -4
  930. package/src/components/block-list/use-block-props/index.js +0 -2
  931. package/src/components/block-list/use-block-props/use-focus-first-element.js +5 -3
  932. package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +12 -4
  933. package/src/components/block-list/use-in-between-inserter.js +1 -1
  934. package/src/components/block-list/zoom-out-separator.js +8 -6
  935. package/src/components/block-patterns-list/stories/fixtures.js +834 -0
  936. package/src/components/block-patterns-list/stories/index.story.js +81 -0
  937. package/src/components/block-patterns-list/style.scss +2 -0
  938. package/src/components/block-patterns-paging/index.js +1 -1
  939. package/src/components/block-popover/index.js +2 -2
  940. package/src/components/block-preview/auto.js +1 -4
  941. package/src/components/block-preview/index.js +2 -2
  942. package/src/components/block-settings-menu/block-settings-dropdown.js +4 -0
  943. package/src/components/block-settings-menu/index.js +3 -0
  944. package/src/components/block-toolbar/change-design.js +133 -0
  945. package/src/components/block-toolbar/index.js +25 -8
  946. package/src/components/block-toolbar/style.scss +16 -0
  947. package/src/components/block-tools/index.js +4 -28
  948. package/src/components/block-tools/insertion-point.js +4 -3
  949. package/src/components/block-tools/style.scss +0 -20
  950. package/src/components/block-tools/use-show-block-tools.js +2 -8
  951. package/src/components/block-tools/zoom-out-mode-inserters.js +25 -40
  952. package/src/components/block-variation-transforms/index.js +2 -2
  953. package/src/components/block-vertical-alignment-control/ui.js +11 -15
  954. package/src/components/border-radius-control/linked-button.js +9 -11
  955. package/src/components/collab/block-comment-icon-slot.js +12 -0
  956. package/src/components/collab/block-comment-icon-toolbar-slot.js +12 -0
  957. package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
  958. package/src/components/convert-to-group-buttons/toolbar.js +4 -4
  959. package/src/components/global-styles/color-panel.js +2 -10
  960. package/src/components/global-styles/test/use-global-styles-context.native.js +1 -0
  961. package/src/components/global-styles/use-global-styles-context.native.js +6 -0
  962. package/src/components/iframe/content.scss +22 -32
  963. package/src/components/iframe/index.js +62 -15
  964. package/src/components/iframe/style.scss +17 -0
  965. package/src/components/image-size-control/index.js +74 -43
  966. package/src/components/image-size-control/test/index.js +5 -63
  967. package/src/components/inner-blocks/index.js +12 -6
  968. package/src/components/inner-blocks/use-nested-settings-update.js +16 -10
  969. package/src/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +1 -1
  970. package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +2 -3
  971. package/src/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
  972. package/src/components/inserter/category-tabs/index.js +17 -13
  973. package/src/components/inserter/menu.js +12 -5
  974. package/src/components/inserter/quick-inserter.js +1 -1
  975. package/src/components/inserter/style.scss +14 -41
  976. package/src/components/inserter-button/index.native.js +1 -1
  977. package/src/components/inspector-controls-tabs/index.js +1 -6
  978. package/src/components/inspector-controls-tabs/utils.js +0 -3
  979. package/src/components/link-control/link-preview.js +15 -8
  980. package/src/components/link-control/search-input.js +4 -5
  981. package/src/components/link-control/search-results.js +2 -13
  982. package/src/components/link-control/test/index.js +147 -70
  983. package/src/components/list-view/appender.js +5 -6
  984. package/src/components/list-view/branch.js +8 -6
  985. package/src/components/list-view/index.js +1 -2
  986. package/src/components/media-replace-flow/test/index.js +1 -1
  987. package/src/components/provider/index.js +1 -3
  988. package/src/components/provider/test/experimental-provider.js +43 -1
  989. package/src/components/responsive-block-control/style.scss +0 -1
  990. package/src/components/rich-text/event-listeners/index.js +4 -2
  991. package/src/components/rich-text/index.native.js +0 -2
  992. package/src/components/rich-text/style.scss +5 -0
  993. package/src/components/spacing-sizes-control/index.js +3 -3
  994. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -4
  995. package/src/components/spacing-sizes-control/linked-button.js +2 -12
  996. package/src/components/tool-selector/index.js +6 -5
  997. package/src/components/url-input/index.js +1 -1
  998. package/src/components/use-block-commands/index.js +1 -1
  999. package/src/components/use-block-drop-zone/index.js +5 -5
  1000. package/src/components/use-block-drop-zone/index.native.js +0 -1
  1001. package/src/components/use-moving-animation/index.js +0 -1
  1002. package/src/components/use-resize-canvas/index.js +1 -3
  1003. package/src/components/use-settings/index.js +0 -1
  1004. package/src/components/writing-flow/index.js +5 -3
  1005. package/src/components/writing-flow/use-tab-nav.js +27 -4
  1006. package/src/hooks/block-bindings.js +48 -31
  1007. package/src/hooks/contrast-checker.js +0 -1
  1008. package/src/hooks/duotone.js +2 -2
  1009. package/src/hooks/grid-visualizer.js +23 -9
  1010. package/src/hooks/layout-child.js +48 -3
  1011. package/src/hooks/style.js +7 -3
  1012. package/src/hooks/use-zoom-out.js +20 -24
  1013. package/src/index.js +0 -1
  1014. package/src/private-apis.js +6 -1
  1015. package/src/store/actions.js +5 -53
  1016. package/src/store/defaults.js +2 -1
  1017. package/src/store/private-actions.js +71 -8
  1018. package/src/store/private-selectors.js +9 -19
  1019. package/src/store/reducer.js +25 -28
  1020. package/src/store/selectors.js +82 -20
  1021. package/src/store/test/actions.js +41 -0
  1022. package/src/store/test/private-selectors.js +7 -1
  1023. package/src/store/test/reducer.js +23 -0
  1024. package/src/store/test/selectors.js +13 -2
  1025. package/src/style.scss +1 -0
  1026. package/src/utils/block-bindings.js +9 -6
  1027. package/src/utils/dom.js +22 -2
  1028. package/src/utils/get-font-styles-and-weights.js +2 -2
  1029. package/src/utils/test/use-block-bindings-utils.js +174 -0
  1030. package/src/utils/transform-styles/index.js +3 -2
  1031. package/tsconfig.tsbuildinfo +1 -1
  1032. package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -57
  1033. package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +0 -1
  1034. package/build/components/block-toolbar/shuffle.js +0 -110
  1035. package/build/components/block-toolbar/shuffle.js.map +0 -1
  1036. package/build/components/block-tools/zoom-out-popover.js +0 -57
  1037. package/build/components/block-tools/zoom-out-popover.js.map +0 -1
  1038. package/build/components/block-tools/zoom-out-toolbar.js +0 -149
  1039. package/build/components/block-tools/zoom-out-toolbar.js.map +0 -1
  1040. package/build/components/block-vertical-alignment-control/icons.js +0 -48
  1041. package/build/components/block-vertical-alignment-control/icons.js.map +0 -1
  1042. package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -51
  1043. package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +0 -1
  1044. package/build-module/components/block-toolbar/shuffle.js +0 -103
  1045. package/build-module/components/block-toolbar/shuffle.js.map +0 -1
  1046. package/build-module/components/block-tools/zoom-out-popover.js +0 -48
  1047. package/build-module/components/block-tools/zoom-out-popover.js.map +0 -1
  1048. package/build-module/components/block-tools/zoom-out-toolbar.js +0 -142
  1049. package/build-module/components/block-tools/zoom-out-toolbar.js.map +0 -1
  1050. package/build-module/components/block-vertical-alignment-control/icons.js +0 -41
  1051. package/build-module/components/block-vertical-alignment-control/icons.js.map +0 -1
  1052. package/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -65
  1053. package/src/components/block-toolbar/shuffle.js +0 -111
  1054. package/src/components/block-tools/zoom-out-popover.js +0 -46
  1055. package/src/components/block-tools/zoom-out-toolbar.js +0 -156
  1056. package/src/components/block-vertical-alignment-control/icons.js +0 -34
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","__","Button","edit","LinkViewerURL","jsx","_jsx","jsxs","_jsxs","LinkViewer","className","linkClassName","onEditLinkClick","url","urlLabel","props","children","icon","label","onClick","size"],"sources":["@wordpress/block-editor/src/components/url-popover/link-viewer.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { edit } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport LinkViewerURL from './link-viewer-url';\n\nexport default function LinkViewer( {\n\tclassName,\n\tlinkClassName,\n\tonEditLinkClick,\n\turl,\n\turlLabel,\n\t...props\n} ) {\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx(\n\t\t\t\t'block-editor-url-popover__link-viewer',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<LinkViewerURL\n\t\t\t\turl={ url }\n\t\t\t\turlLabel={ urlLabel }\n\t\t\t\tclassName={ linkClassName }\n\t\t\t/>\n\t\t\t{ onEditLinkClick && (\n\t\t\t\t<Button\n\t\t\t\t\ticon={ edit }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\tonClick={ onEditLinkClick }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,IAAI,QAAQ,kBAAkB;;AAEvC;AACA;AACA;AACA,OAAOC,aAAa,MAAM,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAE9C,eAAe,SAASC,UAAUA,CAAE;EACnCC,SAAS;EACTC,aAAa;EACbC,eAAe;EACfC,GAAG;EACHC,QAAQ;EACR,GAAGC;AACJ,CAAC,EAAG;EACH,oBACCP,KAAA;IACCE,SAAS,EAAGV,IAAI,CACf,uCAAuC,EACvCU,SACD,CAAG;IAAA,GACEK,KAAK;IAAAC,QAAA,gBAEVV,IAAA,CAACF,aAAa;MACbS,GAAG,EAAGA,GAAK;MACXC,QAAQ,EAAGA,QAAU;MACrBJ,SAAS,EAAGC;IAAe,CAC3B,CAAC,EACAC,eAAe,iBAChBN,IAAA,CAACJ,MAAM;MACNe,IAAI,EAAGd,IAAM;MACbe,KAAK,EAAGjB,EAAE,CAAE,MAAO,CAAG;MACtBkB,OAAO,EAAGP,eAAiB;MAC3BQ,IAAI,EAAC;IAAS,CACd,CACD;EAAA,CACG,CAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["clsx","__","Button","edit","LinkViewerURL","jsx","_jsx","jsxs","_jsxs","LinkViewer","className","linkClassName","onEditLinkClick","url","urlLabel","props","children","icon","label","onClick","size"],"sources":["@wordpress/block-editor/src/components/url-popover/link-viewer.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { edit } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport LinkViewerURL from './link-viewer-url';\n\nexport default function LinkViewer( {\n\tclassName,\n\tlinkClassName,\n\tonEditLinkClick,\n\turl,\n\turlLabel,\n\t...props\n} ) {\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx(\n\t\t\t\t'block-editor-url-popover__link-viewer',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<LinkViewerURL\n\t\t\t\turl={ url }\n\t\t\t\turlLabel={ urlLabel }\n\t\t\t\tclassName={ linkClassName }\n\t\t\t/>\n\t\t\t{ onEditLinkClick && (\n\t\t\t\t<Button\n\t\t\t\t\ticon={ edit }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\tonClick={ onEditLinkClick }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,IAAI,QAAQ,kBAAkB;;AAEvC;AACA;AACA;AACA,OAAOC,aAAa,MAAM,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE9C,eAAe,SAASC,UAAUA,CAAE;EACnCC,SAAS;EACTC,aAAa;EACbC,eAAe;EACfC,GAAG;EACHC,QAAQ;EACR,GAAGC;AACJ,CAAC,EAAG;EACH,oBACCP,KAAA;IACCE,SAAS,EAAGV,IAAI,CACf,uCAAuC,EACvCU,SACD,CAAG;IAAA,GACEK,KAAK;IAAAC,QAAA,gBAEVV,IAAA,CAACF,aAAa;MACbS,GAAG,EAAGA,GAAK;MACXC,QAAQ,EAAGA,QAAU;MACrBJ,SAAS,EAAGC;IAAe,CAC3B,CAAC,EACAC,eAAe,iBAChBN,IAAA,CAACJ,MAAM;MACNe,IAAI,EAAGd,IAAM;MACbe,KAAK,EAAGjB,EAAE,CAAE,MAAO,CAAG;MACtBkB,OAAO,EAAGP,eAAiB;MAC3BQ,IAAI,EAAC;IAAS,CACd,CACD;EAAA,CACG,CAAC;AAER","ignoreList":[]}
@@ -93,7 +93,7 @@ export const useTransformCommands = () => {
93
93
  } = transformation;
94
94
  return {
95
95
  name: 'core/block-editor/transform-to-' + name.replace('/', '-'),
96
- // translators: %s: block title/name.
96
+ /* translators: %s: Block or block variation name. */
97
97
  label: sprintf(__('Transform to %s'), title),
98
98
  icon: /*#__PURE__*/_jsx(BlockIcon, {
99
99
  icon: icon
@@ -1 +1 @@
1
- {"version":3,"names":["__","sprintf","hasBlockSupport","store","blocksStore","switchToBlockType","isTemplatePart","useSelect","useDispatch","useCommandLoader","copy","trash","remove","plus","add","group","ungroup","BlockIcon","blockEditorStore","jsx","_jsx","useTransformCommands","replaceBlocks","multiSelect","blocks","clientIds","canRemove","possibleBlockTransformations","invalidSelection","select","getBlockRootClientId","getBlockTransformItems","getSelectedBlockClientIds","getBlocksByClientId","canRemoveBlocks","selectedBlockClientIds","selectedBlocks","filter","block","length","rootClientId","isLoading","commands","isTemplate","selectForMultipleBlocks","insertedBlocks","clientId","onBlockTransform","name","newBlocks","hasPossibleBlockTransformations","map","transformation","title","icon","replace","label","callback","close","useQuickActionsCommands","isUngroupable","isGroupable","_isUngroupable","_isGroupable","canInsertBlockType","getDefaultBlockName","getGroupingBlockName","removeBlocks","duplicateBlocks","insertAfterBlock","insertBeforeBlock","onGroup","groupingBlockName","onUngroup","innerBlocks","canInsertDefaultBlock","canDuplicate","every","push","Array","isArray","command","useBlockCommands","hook","context"],"sources":["@wordpress/block-editor/src/components/use-block-commands/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\thasBlockSupport,\n\tstore as blocksStore,\n\tswitchToBlockType,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useCommandLoader } from '@wordpress/commands';\nimport {\n\tcopy,\n\ttrash as remove,\n\tplus as add,\n\tgroup,\n\tungroup,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport { store as blockEditorStore } from '../../store';\n\nexport const useTransformCommands = () => {\n\tconst { replaceBlocks, multiSelect } = useDispatch( blockEditorStore );\n\tconst {\n\t\tblocks,\n\t\tclientIds,\n\t\tcanRemove,\n\t\tpossibleBlockTransformations,\n\t\tinvalidSelection,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockRootClientId,\n\t\t\tgetBlockTransformItems,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tgetBlocksByClientId,\n\t\t\tcanRemoveBlocks,\n\t\t} = select( blockEditorStore );\n\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst selectedBlocks = getBlocksByClientId( selectedBlockClientIds );\n\n\t\t// selectedBlocks can have `null`s when something tries to call `selectBlock` with an inexistent clientId.\n\t\t// These nulls will cause fatal errors down the line.\n\t\t// In order to prevent discrepancies between selectedBlockClientIds and selectedBlocks, we effectively treat the entire selection as invalid.\n\t\t// @see https://github.com/WordPress/gutenberg/pull/59410#issuecomment-2006304536\n\t\tif ( selectedBlocks.filter( ( block ) => ! block ).length > 0 ) {\n\t\t\treturn {\n\t\t\t\tinvalidSelection: true,\n\t\t\t};\n\t\t}\n\n\t\tconst rootClientId = getBlockRootClientId(\n\t\t\tselectedBlockClientIds[ 0 ]\n\t\t);\n\t\treturn {\n\t\t\tblocks: selectedBlocks,\n\t\t\tclientIds: selectedBlockClientIds,\n\t\t\tpossibleBlockTransformations: getBlockTransformItems(\n\t\t\t\tselectedBlocks,\n\t\t\t\trootClientId\n\t\t\t),\n\t\t\tcanRemove: canRemoveBlocks( selectedBlockClientIds ),\n\t\t\tinvalidSelection: false,\n\t\t};\n\t}, [] );\n\n\tif ( invalidSelection ) {\n\t\treturn {\n\t\t\tisLoading: false,\n\t\t\tcommands: [],\n\t\t};\n\t}\n\tconst isTemplate = blocks.length === 1 && isTemplatePart( blocks[ 0 ] );\n\n\tfunction selectForMultipleBlocks( insertedBlocks ) {\n\t\tif ( insertedBlocks.length > 1 ) {\n\t\t\tmultiSelect(\n\t\t\t\tinsertedBlocks[ 0 ].clientId,\n\t\t\t\tinsertedBlocks[ insertedBlocks.length - 1 ].clientId\n\t\t\t);\n\t\t}\n\t}\n\n\t// Simple block tranformation based on the `Block Transforms` API.\n\tfunction onBlockTransform( name ) {\n\t\tconst newBlocks = switchToBlockType( blocks, name );\n\t\treplaceBlocks( clientIds, newBlocks );\n\t\tselectForMultipleBlocks( newBlocks );\n\t}\n\n\t/**\n\t * The `isTemplate` check is a stopgap solution here.\n\t * Ideally, the Transforms API should handle this\n\t * by allowing to exclude blocks from wildcard transformations.\n\t */\n\tconst hasPossibleBlockTransformations =\n\t\t!! possibleBlockTransformations.length && canRemove && ! isTemplate;\n\n\tif (\n\t\t! clientIds ||\n\t\tclientIds.length < 1 ||\n\t\t! hasPossibleBlockTransformations\n\t) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = possibleBlockTransformations.map( ( transformation ) => {\n\t\tconst { name, title, icon } = transformation;\n\t\treturn {\n\t\t\tname: 'core/block-editor/transform-to-' + name.replace( '/', '-' ),\n\t\t\t// translators: %s: block title/name.\n\t\t\tlabel: sprintf( __( 'Transform to %s' ), title ),\n\t\t\ticon: <BlockIcon icon={ icon } />,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tonBlockTransform( name );\n\t\t\t\tclose();\n\t\t\t},\n\t\t};\n\t} );\n\n\treturn { isLoading: false, commands };\n};\n\nconst useQuickActionsCommands = () => {\n\tconst { clientIds, isUngroupable, isGroupable } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tisUngroupable: _isUngroupable,\n\t\t\tisGroupable: _isGroupable,\n\t\t} = select( blockEditorStore );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\n\t\treturn {\n\t\t\tclientIds: selectedBlockClientIds,\n\t\t\tisUngroupable: _isUngroupable(),\n\t\t\tisGroupable: _isGroupable(),\n\t\t};\n\t}, [] );\n\tconst {\n\t\tcanInsertBlockType,\n\t\tgetBlockRootClientId,\n\t\tgetBlocksByClientId,\n\t\tcanRemoveBlocks,\n\t} = useSelect( blockEditorStore );\n\tconst { getDefaultBlockName, getGroupingBlockName } =\n\t\tuseSelect( blocksStore );\n\n\tconst blocks = getBlocksByClientId( clientIds );\n\n\tconst {\n\t\tremoveBlocks,\n\t\treplaceBlocks,\n\t\tduplicateBlocks,\n\t\tinsertAfterBlock,\n\t\tinsertBeforeBlock,\n\t} = useDispatch( blockEditorStore );\n\n\tconst onGroup = () => {\n\t\tif ( ! blocks.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst groupingBlockName = getGroupingBlockName();\n\n\t\t// Activate the `transform` on `core/group` which does the conversion.\n\t\tconst newBlocks = switchToBlockType( blocks, groupingBlockName );\n\n\t\tif ( ! newBlocks ) {\n\t\t\treturn;\n\t\t}\n\t\treplaceBlocks( clientIds, newBlocks );\n\t};\n\tconst onUngroup = () => {\n\t\tif ( ! blocks.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst innerBlocks = blocks[ 0 ].innerBlocks;\n\n\t\tif ( ! innerBlocks.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\treplaceBlocks( clientIds, innerBlocks );\n\t};\n\n\tif ( ! clientIds || clientIds.length < 1 ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\tconst canInsertDefaultBlock = canInsertBlockType(\n\t\tgetDefaultBlockName(),\n\t\trootClientId\n\t);\n\tconst canDuplicate = blocks.every( ( block ) => {\n\t\treturn (\n\t\t\t!! block &&\n\t\t\thasBlockSupport( block.name, 'multiple', true ) &&\n\t\t\tcanInsertBlockType( block.name, rootClientId )\n\t\t);\n\t} );\n\tconst canRemove = canRemoveBlocks( clientIds );\n\n\tconst commands = [];\n\n\tif ( canDuplicate ) {\n\t\tcommands.push( {\n\t\t\tname: 'duplicate',\n\t\t\tlabel: __( 'Duplicate' ),\n\t\t\tcallback: () => duplicateBlocks( clientIds, true ),\n\t\t\ticon: copy,\n\t\t} );\n\t}\n\n\tif ( canInsertDefaultBlock ) {\n\t\tcommands.push(\n\t\t\t{\n\t\t\t\tname: 'add-before',\n\t\t\t\tlabel: __( 'Add before' ),\n\t\t\t\tcallback: () => {\n\t\t\t\t\tconst clientId = Array.isArray( clientIds )\n\t\t\t\t\t\t? clientIds[ 0 ]\n\t\t\t\t\t\t: clientId;\n\t\t\t\t\tinsertBeforeBlock( clientId );\n\t\t\t\t},\n\t\t\t\ticon: add,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'add-after',\n\t\t\t\tlabel: __( 'Add after' ),\n\t\t\t\tcallback: () => {\n\t\t\t\t\tconst clientId = Array.isArray( clientIds )\n\t\t\t\t\t\t? clientIds[ clientIds.length - 1 ]\n\t\t\t\t\t\t: clientId;\n\t\t\t\t\tinsertAfterBlock( clientId );\n\t\t\t\t},\n\t\t\t\ticon: add,\n\t\t\t}\n\t\t);\n\t}\n\n\tif ( isGroupable ) {\n\t\tcommands.push( {\n\t\t\tname: 'Group',\n\t\t\tlabel: __( 'Group' ),\n\t\t\tcallback: onGroup,\n\t\t\ticon: group,\n\t\t} );\n\t}\n\n\tif ( isUngroupable ) {\n\t\tcommands.push( {\n\t\t\tname: 'ungroup',\n\t\t\tlabel: __( 'Ungroup' ),\n\t\t\tcallback: onUngroup,\n\t\t\ticon: ungroup,\n\t\t} );\n\t}\n\n\tif ( canRemove ) {\n\t\tcommands.push( {\n\t\t\tname: 'remove',\n\t\t\tlabel: __( 'Delete' ),\n\t\t\tcallback: () => removeBlocks( clientIds, true ),\n\t\t\ticon: remove,\n\t\t} );\n\t}\n\n\treturn {\n\t\tisLoading: false,\n\t\tcommands: commands.map( ( command ) => ( {\n\t\t\t...command,\n\t\t\tname: 'core/block-editor/action-' + command.name,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tcommand.callback();\n\t\t\t\tclose();\n\t\t\t},\n\t\t} ) ),\n\t};\n};\n\nexport const useBlockCommands = () => {\n\tuseCommandLoader( {\n\t\tname: 'core/block-editor/blockTransforms',\n\t\thook: useTransformCommands,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/block-editor/blockQuickActions',\n\t\thook: useQuickActionsCommands,\n\t\tcontext: 'block-selection-edit',\n\t} );\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SACCC,eAAe,EACfC,KAAK,IAAIC,WAAW,EACpBC,iBAAiB,EACjBC,cAAc,QACR,mBAAmB;AAC1B,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,gBAAgB,QAAQ,qBAAqB;AACtD,SACCC,IAAI,EACJC,KAAK,IAAIC,MAAM,EACfC,IAAI,IAAIC,GAAG,EACXC,KAAK,EACLC,OAAO,QACD,kBAAkB;;AAEzB;AACA;AACA;AACA,OAAOC,SAAS,MAAM,eAAe;AACrC,SAASd,KAAK,IAAIe,gBAAgB,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAExD,OAAO,MAAMC,oBAAoB,GAAGA,CAAA,KAAM;EACzC,MAAM;IAAEC,aAAa;IAAEC;EAAY,CAAC,GAAGf,WAAW,CAAEU,gBAAiB,CAAC;EACtE,MAAM;IACLM,MAAM;IACNC,SAAS;IACTC,SAAS;IACTC,4BAA4B;IAC5BC;EACD,CAAC,GAAGrB,SAAS,CAAIsB,MAAM,IAAM;IAC5B,MAAM;MACLC,oBAAoB;MACpBC,sBAAsB;MACtBC,yBAAyB;MACzBC,mBAAmB;MACnBC;IACD,CAAC,GAAGL,MAAM,CAAEX,gBAAiB,CAAC;IAE9B,MAAMiB,sBAAsB,GAAGH,yBAAyB,CAAC,CAAC;IAC1D,MAAMI,cAAc,GAAGH,mBAAmB,CAAEE,sBAAuB,CAAC;;IAEpE;IACA;IACA;IACA;IACA,IAAKC,cAAc,CAACC,MAAM,CAAIC,KAAK,IAAM,CAAEA,KAAM,CAAC,CAACC,MAAM,GAAG,CAAC,EAAG;MAC/D,OAAO;QACNX,gBAAgB,EAAE;MACnB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AAE;EACV,CAAE,CAAC;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["__","sprintf","hasBlockSupport","store","blocksStore","switchToBlockType","isTemplatePart","useSelect","useDispatch","useCommandLoader","copy","trash","remove","plus","add","group","ungroup","BlockIcon","blockEditorStore","jsx","_jsx","useTransformCommands","replaceBlocks","multiSelect","blocks","clientIds","canRemove","possibleBlockTransformations","invalidSelection","select","getBlockRootClientId","getBlockTransformItems","getSelectedBlockClientIds","getBlocksByClientId","canRemoveBlocks","selectedBlockClientIds","selectedBlocks","filter","block","length","rootClientId","isLoading","commands","isTemplate","selectForMultipleBlocks","insertedBlocks","clientId","onBlockTransform","name","newBlocks","hasPossibleBlockTransformations","map","transformation","title","icon","replace","label","callback","close","useQuickActionsCommands","isUngroupable","isGroupable","_isUngroupable","_isGroupable","canInsertBlockType","getDefaultBlockName","getGroupingBlockName","removeBlocks","duplicateBlocks","insertAfterBlock","insertBeforeBlock","onGroup","groupingBlockName","onUngroup","innerBlocks","canInsertDefaultBlock","canDuplicate","every","push","Array","isArray","command","useBlockCommands","hook","context"],"sources":["@wordpress/block-editor/src/components/use-block-commands/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\thasBlockSupport,\n\tstore as blocksStore,\n\tswitchToBlockType,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useCommandLoader } from '@wordpress/commands';\nimport {\n\tcopy,\n\ttrash as remove,\n\tplus as add,\n\tgroup,\n\tungroup,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport { store as blockEditorStore } from '../../store';\n\nexport const useTransformCommands = () => {\n\tconst { replaceBlocks, multiSelect } = useDispatch( blockEditorStore );\n\tconst {\n\t\tblocks,\n\t\tclientIds,\n\t\tcanRemove,\n\t\tpossibleBlockTransformations,\n\t\tinvalidSelection,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockRootClientId,\n\t\t\tgetBlockTransformItems,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tgetBlocksByClientId,\n\t\t\tcanRemoveBlocks,\n\t\t} = select( blockEditorStore );\n\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst selectedBlocks = getBlocksByClientId( selectedBlockClientIds );\n\n\t\t// selectedBlocks can have `null`s when something tries to call `selectBlock` with an inexistent clientId.\n\t\t// These nulls will cause fatal errors down the line.\n\t\t// In order to prevent discrepancies between selectedBlockClientIds and selectedBlocks, we effectively treat the entire selection as invalid.\n\t\t// @see https://github.com/WordPress/gutenberg/pull/59410#issuecomment-2006304536\n\t\tif ( selectedBlocks.filter( ( block ) => ! block ).length > 0 ) {\n\t\t\treturn {\n\t\t\t\tinvalidSelection: true,\n\t\t\t};\n\t\t}\n\n\t\tconst rootClientId = getBlockRootClientId(\n\t\t\tselectedBlockClientIds[ 0 ]\n\t\t);\n\t\treturn {\n\t\t\tblocks: selectedBlocks,\n\t\t\tclientIds: selectedBlockClientIds,\n\t\t\tpossibleBlockTransformations: getBlockTransformItems(\n\t\t\t\tselectedBlocks,\n\t\t\t\trootClientId\n\t\t\t),\n\t\t\tcanRemove: canRemoveBlocks( selectedBlockClientIds ),\n\t\t\tinvalidSelection: false,\n\t\t};\n\t}, [] );\n\n\tif ( invalidSelection ) {\n\t\treturn {\n\t\t\tisLoading: false,\n\t\t\tcommands: [],\n\t\t};\n\t}\n\tconst isTemplate = blocks.length === 1 && isTemplatePart( blocks[ 0 ] );\n\n\tfunction selectForMultipleBlocks( insertedBlocks ) {\n\t\tif ( insertedBlocks.length > 1 ) {\n\t\t\tmultiSelect(\n\t\t\t\tinsertedBlocks[ 0 ].clientId,\n\t\t\t\tinsertedBlocks[ insertedBlocks.length - 1 ].clientId\n\t\t\t);\n\t\t}\n\t}\n\n\t// Simple block tranformation based on the `Block Transforms` API.\n\tfunction onBlockTransform( name ) {\n\t\tconst newBlocks = switchToBlockType( blocks, name );\n\t\treplaceBlocks( clientIds, newBlocks );\n\t\tselectForMultipleBlocks( newBlocks );\n\t}\n\n\t/**\n\t * The `isTemplate` check is a stopgap solution here.\n\t * Ideally, the Transforms API should handle this\n\t * by allowing to exclude blocks from wildcard transformations.\n\t */\n\tconst hasPossibleBlockTransformations =\n\t\t!! possibleBlockTransformations.length && canRemove && ! isTemplate;\n\n\tif (\n\t\t! clientIds ||\n\t\tclientIds.length < 1 ||\n\t\t! hasPossibleBlockTransformations\n\t) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = possibleBlockTransformations.map( ( transformation ) => {\n\t\tconst { name, title, icon } = transformation;\n\t\treturn {\n\t\t\tname: 'core/block-editor/transform-to-' + name.replace( '/', '-' ),\n\t\t\t/* translators: %s: Block or block variation name. */\n\t\t\tlabel: sprintf( __( 'Transform to %s' ), title ),\n\t\t\ticon: <BlockIcon icon={ icon } />,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tonBlockTransform( name );\n\t\t\t\tclose();\n\t\t\t},\n\t\t};\n\t} );\n\n\treturn { isLoading: false, commands };\n};\n\nconst useQuickActionsCommands = () => {\n\tconst { clientIds, isUngroupable, isGroupable } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tisUngroupable: _isUngroupable,\n\t\t\tisGroupable: _isGroupable,\n\t\t} = select( blockEditorStore );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\n\t\treturn {\n\t\t\tclientIds: selectedBlockClientIds,\n\t\t\tisUngroupable: _isUngroupable(),\n\t\t\tisGroupable: _isGroupable(),\n\t\t};\n\t}, [] );\n\tconst {\n\t\tcanInsertBlockType,\n\t\tgetBlockRootClientId,\n\t\tgetBlocksByClientId,\n\t\tcanRemoveBlocks,\n\t} = useSelect( blockEditorStore );\n\tconst { getDefaultBlockName, getGroupingBlockName } =\n\t\tuseSelect( blocksStore );\n\n\tconst blocks = getBlocksByClientId( clientIds );\n\n\tconst {\n\t\tremoveBlocks,\n\t\treplaceBlocks,\n\t\tduplicateBlocks,\n\t\tinsertAfterBlock,\n\t\tinsertBeforeBlock,\n\t} = useDispatch( blockEditorStore );\n\n\tconst onGroup = () => {\n\t\tif ( ! blocks.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst groupingBlockName = getGroupingBlockName();\n\n\t\t// Activate the `transform` on `core/group` which does the conversion.\n\t\tconst newBlocks = switchToBlockType( blocks, groupingBlockName );\n\n\t\tif ( ! newBlocks ) {\n\t\t\treturn;\n\t\t}\n\t\treplaceBlocks( clientIds, newBlocks );\n\t};\n\tconst onUngroup = () => {\n\t\tif ( ! blocks.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst innerBlocks = blocks[ 0 ].innerBlocks;\n\n\t\tif ( ! innerBlocks.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\treplaceBlocks( clientIds, innerBlocks );\n\t};\n\n\tif ( ! clientIds || clientIds.length < 1 ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\tconst canInsertDefaultBlock = canInsertBlockType(\n\t\tgetDefaultBlockName(),\n\t\trootClientId\n\t);\n\tconst canDuplicate = blocks.every( ( block ) => {\n\t\treturn (\n\t\t\t!! block &&\n\t\t\thasBlockSupport( block.name, 'multiple', true ) &&\n\t\t\tcanInsertBlockType( block.name, rootClientId )\n\t\t);\n\t} );\n\tconst canRemove = canRemoveBlocks( clientIds );\n\n\tconst commands = [];\n\n\tif ( canDuplicate ) {\n\t\tcommands.push( {\n\t\t\tname: 'duplicate',\n\t\t\tlabel: __( 'Duplicate' ),\n\t\t\tcallback: () => duplicateBlocks( clientIds, true ),\n\t\t\ticon: copy,\n\t\t} );\n\t}\n\n\tif ( canInsertDefaultBlock ) {\n\t\tcommands.push(\n\t\t\t{\n\t\t\t\tname: 'add-before',\n\t\t\t\tlabel: __( 'Add before' ),\n\t\t\t\tcallback: () => {\n\t\t\t\t\tconst clientId = Array.isArray( clientIds )\n\t\t\t\t\t\t? clientIds[ 0 ]\n\t\t\t\t\t\t: clientId;\n\t\t\t\t\tinsertBeforeBlock( clientId );\n\t\t\t\t},\n\t\t\t\ticon: add,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'add-after',\n\t\t\t\tlabel: __( 'Add after' ),\n\t\t\t\tcallback: () => {\n\t\t\t\t\tconst clientId = Array.isArray( clientIds )\n\t\t\t\t\t\t? clientIds[ clientIds.length - 1 ]\n\t\t\t\t\t\t: clientId;\n\t\t\t\t\tinsertAfterBlock( clientId );\n\t\t\t\t},\n\t\t\t\ticon: add,\n\t\t\t}\n\t\t);\n\t}\n\n\tif ( isGroupable ) {\n\t\tcommands.push( {\n\t\t\tname: 'Group',\n\t\t\tlabel: __( 'Group' ),\n\t\t\tcallback: onGroup,\n\t\t\ticon: group,\n\t\t} );\n\t}\n\n\tif ( isUngroupable ) {\n\t\tcommands.push( {\n\t\t\tname: 'ungroup',\n\t\t\tlabel: __( 'Ungroup' ),\n\t\t\tcallback: onUngroup,\n\t\t\ticon: ungroup,\n\t\t} );\n\t}\n\n\tif ( canRemove ) {\n\t\tcommands.push( {\n\t\t\tname: 'remove',\n\t\t\tlabel: __( 'Delete' ),\n\t\t\tcallback: () => removeBlocks( clientIds, true ),\n\t\t\ticon: remove,\n\t\t} );\n\t}\n\n\treturn {\n\t\tisLoading: false,\n\t\tcommands: commands.map( ( command ) => ( {\n\t\t\t...command,\n\t\t\tname: 'core/block-editor/action-' + command.name,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tcommand.callback();\n\t\t\t\tclose();\n\t\t\t},\n\t\t} ) ),\n\t};\n};\n\nexport const useBlockCommands = () => {\n\tuseCommandLoader( {\n\t\tname: 'core/block-editor/blockTransforms',\n\t\thook: useTransformCommands,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/block-editor/blockQuickActions',\n\t\thook: useQuickActionsCommands,\n\t\t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ownerDocument) {
194
194
  const {
195
195
  defaultView
196
196
  } = ownerDocument;
197
- return !!(defaultView && targetToCheck instanceof defaultView.HTMLElement && targetToCheck.dataset.isInsertionPoint);
197
+ return !!(defaultView && targetToCheck instanceof defaultView.HTMLElement && targetToCheck.closest('[data-is-insertion-point]'));
198
198
  }
199
199
 
200
200
  /**
@@ -238,7 +238,7 @@ export default function useBlockDropZone({
238
238
  getAllowedBlocks,
239
239
  isDragging,
240
240
  isGroupable,
241
- isZoomOutMode,
241
+ isZoomOut,
242
242
  getSectionRootClientId
243
243
  } = unlock(useSelect(blockEditorStore));
244
244
  const {
@@ -269,7 +269,7 @@ export default function useBlockDropZone({
269
269
  // In Zoom Out mode, if the target is not the section root provided by settings then
270
270
  // do not allow dropping as the drop target is not within the root (that which is
271
271
  // treated as "the content" by Zoom Out Mode).
272
- if (isZoomOutMode() && sectionRootClientId !== targetRootClientId) {
272
+ if (isZoomOut() && sectionRootClientId !== targetRootClientId) {
273
273
  return;
274
274
  }
275
275
  const blocks = getBlocks(targetRootClientId);
@@ -306,7 +306,7 @@ export default function useBlockDropZone({
306
306
  rootBlockIndex: getBlockIndex(targetRootClientId)
307
307
  });
308
308
  const [targetIndex, operation, nearestSide] = dropTargetPosition;
309
- if (isZoomOutMode() && operation !== 'insert') {
309
+ if (isZoomOut() && operation !== 'insert') {
310
310
  return;
311
311
  }
312
312
  if (operation === 'group') {
@@ -342,7 +342,7 @@ export default function useBlockDropZone({
342
342
  nearestSide
343
343
  });
344
344
  });
345
- }, [isDragging, getAllowedBlocks, targetRootClientId, getBlockNamesByClientId, getDraggedBlockClientIds, getBlockType, getSectionRootClientId, isZoomOutMode, getBlocks, getBlockListSettings, dropZoneElement, parentBlockClientId, getBlockIndex, registry, startDragging, showInsertionPoint, canInsertBlockType, isGroupable, getBlockVariations, getGroupingBlockName]), 200);
345
+ }, [isDragging, getAllowedBlocks, targetRootClientId, getBlockNamesByClientId, getDraggedBlockClientIds, getBlockType, getSectionRootClientId, isZoomOut, getBlocks, getBlockListSettings, dropZoneElement, parentBlockClientId, getBlockIndex, registry, startDragging, showInsertionPoint, canInsertBlockType, isGroupable, getBlockVariations, getGroupingBlockName]), 200);
346
346
  return useDropZone({
347
347
  dropZoneElement,
348
348
  isDisabled,
@@ -1 +1 @@
1
- {"version":3,"names":["useDispatch","useSelect","useRegistry","useCallback","useState","useThrottle","__experimentalUseDropZone","useDropZone","isRTL","isUnmodifiedDefaultBlock","getIsUnmodifiedDefaultBlock","store","blocksStore","useOnBlockDrop","getDistanceToNearestEdge","isPointContainedByRect","isPointWithinTopAndBottomBoundariesOfRect","blockEditorStore","unlock","THRESHOLD_DISTANCE","MINIMUM_HEIGHT_FOR_THRESHOLD","MINIMUM_WIDTH_FOR_THRESHOLD","getDropTargetPosition","blocksData","position","orientation","options","allowedEdges","nearestIndex","insertPosition","minDistance","Infinity","targetBlockIndex","nearestSide","dropZoneElement","parentBlockOrientation","rootBlockIndex","rect","getBoundingClientRect","distance","edge","height","isRightToLeft","width","forEach","blockIndex","blockOrientation","sideDistance","sideEdge","isPointInsideRect","adjacentIndex","isNearestBlockUnmodifiedDefaultBlock","isAdjacentBlockUnmodifiedDefaultBlock","insertionIndex","isDropTargetValid","getBlockType","allowedBlocks","draggedBlockNames","targetBlockName","areBlocksAllowed","allowedBlockNames","map","name","every","includes","draggedBlockTypes","targetMatchesDraggedBlockParents","block","allowedParentName","parent","isInsertionPoint","targetToCheck","ownerDocument","defaultView","HTMLElement","dataset","useBlockDropZone","rootClientId","targetRootClientId","parentClientId","parentBlockClientId","isDisabled","registry","dropTarget","setDropTarget","index","operation","getBlockVariations","getGroupingBlockName","canInsertBlockType","getBlockListSettings","getBlocks","getBlockIndex","getDraggedBlockClientIds","getBlockNamesByClientId","getAllowedBlocks","isDragging","isGroupable","isZoomOutMode","getSectionRootClientId","showInsertionPoint","hideInsertionPoint","startDragging","stopDragging","onBlockDrop","throttled","event","isBlockDroppingAllowed","sectionRootClientId","blocks","length","batch","clientId","getElementById","dropTargetPosition","x","clientX","y","clientY","undefined","targetIndex","targetBlock","areAllImages","canInsertGalleryBlock","areGroupableBlocks","groupBlockVariations","canInsertRow","find","insertionPointClientId","onDrop","onDragOver","currentTarget","onDragLeave","relatedTarget","target","cancel","onDragEnd"],"sources":["@wordpress/block-editor/src/components/use-block-drop-zone/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { useCallback, useState } from '@wordpress/element';\nimport {\n\tuseThrottle,\n\t__experimentalUseDropZone as useDropZone,\n} from '@wordpress/compose';\nimport { isRTL } from '@wordpress/i18n';\nimport {\n\tisUnmodifiedDefaultBlock as getIsUnmodifiedDefaultBlock,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport useOnBlockDrop from '../use-on-block-drop';\nimport {\n\tgetDistanceToNearestEdge,\n\tisPointContainedByRect,\n\tisPointWithinTopAndBottomBoundariesOfRect,\n} from '../../utils/math';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst THRESHOLD_DISTANCE = 30;\nconst MINIMUM_HEIGHT_FOR_THRESHOLD = 120;\nconst MINIMUM_WIDTH_FOR_THRESHOLD = 120;\n\n/** @typedef {import('../../utils/math').WPPoint} WPPoint */\n/** @typedef {import('../use-on-block-drop/types').WPDropOperation} WPDropOperation */\n\n/**\n * The orientation of a block list.\n *\n * @typedef {'horizontal'|'vertical'|undefined} WPBlockListOrientation\n */\n\n/**\n * The insert position when dropping a block.\n *\n * @typedef {'before'|'after'} WPInsertPosition\n */\n\n/**\n * @typedef {Object} WPBlockData\n * @property {boolean} isUnmodifiedDefaultBlock Is the block unmodified default block.\n * @property {() => DOMRect} getBoundingClientRect Get the bounding client rect of the block.\n * @property {number} blockIndex The index of the block.\n */\n\n/**\n * Get the drop target position from a given drop point and the orientation.\n *\n * @param {WPBlockData[]} blocksData The block data list.\n * @param {WPPoint} position The position of the item being dragged.\n * @param {WPBlockListOrientation} orientation The orientation of the block list.\n * @param {Object} options Additional options.\n * @return {[number, WPDropOperation]} The drop target position.\n */\nexport function getDropTargetPosition(\n\tblocksData,\n\tposition,\n\torientation = 'vertical',\n\toptions = {}\n) {\n\tconst allowedEdges =\n\t\torientation === 'horizontal'\n\t\t\t? [ 'left', 'right' ]\n\t\t\t: [ 'top', 'bottom' ];\n\n\tlet nearestIndex = 0;\n\tlet insertPosition = 'before';\n\tlet minDistance = Infinity;\n\tlet targetBlockIndex = null;\n\tlet nearestSide = 'right';\n\n\tconst {\n\t\tdropZoneElement,\n\t\tparentBlockOrientation,\n\t\trootBlockIndex = 0,\n\t} = options;\n\n\t// Allow before/after when dragging over the top/bottom edges of the drop zone.\n\tif ( dropZoneElement && parentBlockOrientation !== 'horizontal' ) {\n\t\tconst rect = dropZoneElement.getBoundingClientRect();\n\t\tconst [ distance, edge ] = getDistanceToNearestEdge( position, rect, [\n\t\t\t'top',\n\t\t\t'bottom',\n\t\t] );\n\n\t\t// If dragging over the top or bottom of the drop zone, insert the block\n\t\t// before or after the parent block. This only applies to blocks that use\n\t\t// a drop zone element, typically container blocks such as Group or Cover.\n\t\tif (\n\t\t\trect.height > MINIMUM_HEIGHT_FOR_THRESHOLD &&\n\t\t\tdistance < THRESHOLD_DISTANCE\n\t\t) {\n\t\t\tif ( edge === 'top' ) {\n\t\t\t\treturn [ rootBlockIndex, 'before' ];\n\t\t\t}\n\t\t\tif ( edge === 'bottom' ) {\n\t\t\t\treturn [ rootBlockIndex + 1, 'after' ];\n\t\t\t}\n\t\t}\n\t}\n\n\tconst isRightToLeft = isRTL();\n\n\t// Allow before/after when dragging over the left/right edges of the drop zone.\n\tif ( dropZoneElement && parentBlockOrientation === 'horizontal' ) {\n\t\tconst rect = dropZoneElement.getBoundingClientRect();\n\t\tconst [ distance, edge ] = getDistanceToNearestEdge( position, rect, [\n\t\t\t'left',\n\t\t\t'right',\n\t\t] );\n\n\t\t// If dragging over the left or right of the drop zone, insert the block\n\t\t// before or after the parent block. This only applies to blocks that use\n\t\t// a drop zone element, typically container blocks such as Group.\n\t\tif (\n\t\t\trect.width > MINIMUM_WIDTH_FOR_THRESHOLD &&\n\t\t\tdistance < THRESHOLD_DISTANCE\n\t\t) {\n\t\t\tif (\n\t\t\t\t( isRightToLeft && edge === 'right' ) ||\n\t\t\t\t( ! isRightToLeft && edge === 'left' )\n\t\t\t) {\n\t\t\t\treturn [ rootBlockIndex, 'before' ];\n\t\t\t}\n\t\t\tif (\n\t\t\t\t( isRightToLeft && edge === 'left' ) ||\n\t\t\t\t( ! isRightToLeft && edge === 'right' )\n\t\t\t) {\n\t\t\t\treturn [ rootBlockIndex + 1, 'after' ];\n\t\t\t}\n\t\t}\n\t}\n\n\tblocksData.forEach(\n\t\t( {\n\t\t\tisUnmodifiedDefaultBlock,\n\t\t\tgetBoundingClientRect,\n\t\t\tblockIndex,\n\t\t\tblockOrientation,\n\t\t} ) => {\n\t\t\tconst rect = getBoundingClientRect();\n\n\t\t\tlet [ distance, edge ] = getDistanceToNearestEdge(\n\t\t\t\tposition,\n\t\t\t\trect,\n\t\t\t\tallowedEdges\n\t\t\t);\n\t\t\t// If the the point is close to a side, prioritize that side.\n\t\t\tconst [ sideDistance, sideEdge ] = getDistanceToNearestEdge(\n\t\t\t\tposition,\n\t\t\t\trect,\n\t\t\t\t[ 'left', 'right' ]\n\t\t\t);\n\n\t\t\tconst isPointInsideRect = isPointContainedByRect( position, rect );\n\n\t\t\t// Prioritize the element if the point is inside of an unmodified default block.\n\t\t\tif ( isUnmodifiedDefaultBlock && isPointInsideRect ) {\n\t\t\t\tdistance = 0;\n\t\t\t} else if (\n\t\t\t\torientation === 'vertical' &&\n\t\t\t\tblockOrientation !== 'horizontal' &&\n\t\t\t\t( ( isPointInsideRect && sideDistance < THRESHOLD_DISTANCE ) ||\n\t\t\t\t\t( ! isPointInsideRect &&\n\t\t\t\t\t\tisPointWithinTopAndBottomBoundariesOfRect(\n\t\t\t\t\t\t\tposition,\n\t\t\t\t\t\t\trect\n\t\t\t\t\t\t) ) )\n\t\t\t) {\n\t\t\t\t/**\n\t\t\t\t * This condition should only apply when the layout is vertical (otherwise there's\n\t\t\t\t * no need to create a Row) and dropzones should only activate when the block is\n\t\t\t\t * either within and close to the sides of the target block or on its outer sides.\n\t\t\t\t */\n\t\t\t\ttargetBlockIndex = blockIndex;\n\t\t\t\tnearestSide = sideEdge;\n\t\t\t}\n\n\t\t\tif ( distance < minDistance ) {\n\t\t\t\t// Where the dropped block will be inserted on the nearest block.\n\t\t\t\tinsertPosition =\n\t\t\t\t\tedge === 'bottom' ||\n\t\t\t\t\t( ! isRightToLeft && edge === 'right' ) ||\n\t\t\t\t\t( isRightToLeft && edge === 'left' )\n\t\t\t\t\t\t? 'after'\n\t\t\t\t\t\t: 'before';\n\n\t\t\t\t// Update the currently known best candidate.\n\t\t\t\tminDistance = distance;\n\t\t\t\tnearestIndex = blockIndex;\n\t\t\t}\n\t\t}\n\t);\n\n\tconst adjacentIndex =\n\t\tnearestIndex + ( insertPosition === 'after' ? 1 : -1 );\n\tconst isNearestBlockUnmodifiedDefaultBlock =\n\t\t!! blocksData[ nearestIndex ]?.isUnmodifiedDefaultBlock;\n\tconst isAdjacentBlockUnmodifiedDefaultBlock =\n\t\t!! blocksData[ adjacentIndex ]?.isUnmodifiedDefaultBlock;\n\n\t// If the target index is set then group with the block at that index.\n\tif ( targetBlockIndex !== null ) {\n\t\treturn [ targetBlockIndex, 'group', nearestSide ];\n\t}\n\t// If both blocks are not unmodified default blocks then just insert between them.\n\tif (\n\t\t! isNearestBlockUnmodifiedDefaultBlock &&\n\t\t! isAdjacentBlockUnmodifiedDefaultBlock\n\t) {\n\t\t// If the user is dropping to the trailing edge of the block\n\t\t// add 1 to the index to represent dragging after.\n\t\tconst insertionIndex =\n\t\t\tinsertPosition === 'after' ? nearestIndex + 1 : nearestIndex;\n\t\treturn [ insertionIndex, 'insert' ];\n\t}\n\n\t// Otherwise, replace the nearest unmodified default block.\n\treturn [\n\t\tisNearestBlockUnmodifiedDefaultBlock ? nearestIndex : adjacentIndex,\n\t\t'replace',\n\t];\n}\n\n/**\n * Check if the dragged blocks can be dropped on the target.\n * @param {Function} getBlockType\n * @param {Object[]} allowedBlocks\n * @param {string[]} draggedBlockNames\n * @param {string} targetBlockName\n * @return {boolean} Whether the dragged blocks can be dropped on the target.\n */\nexport function isDropTargetValid(\n\tgetBlockType,\n\tallowedBlocks,\n\tdraggedBlockNames,\n\ttargetBlockName\n) {\n\t// At root level allowedBlocks is undefined and all blocks are allowed.\n\t// Otherwise, check if all dragged blocks are allowed.\n\tlet areBlocksAllowed = true;\n\tif ( allowedBlocks ) {\n\t\tconst allowedBlockNames = allowedBlocks?.map( ( { name } ) => name );\n\n\t\tareBlocksAllowed = draggedBlockNames.every( ( name ) =>\n\t\t\tallowedBlockNames?.includes( name )\n\t\t);\n\t}\n\n\t// Work out if dragged blocks have an allowed parent and if so\n\t// check target block matches the allowed parent.\n\tconst draggedBlockTypes = draggedBlockNames.map( ( name ) =>\n\t\tgetBlockType( name )\n\t);\n\tconst targetMatchesDraggedBlockParents = draggedBlockTypes.every(\n\t\t( block ) => {\n\t\t\tconst [ allowedParentName ] = block?.parent || [];\n\t\t\tif ( ! allowedParentName ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn allowedParentName === targetBlockName;\n\t\t}\n\t);\n\n\treturn areBlocksAllowed && targetMatchesDraggedBlockParents;\n}\n\n/**\n * Checks if the given element is an insertion point.\n *\n * @param {EventTarget|null} targetToCheck - The element to check.\n * @param {Document} ownerDocument - The owner document of the element.\n * @return {boolean} True if the element is a insertion point, false otherwise.\n */\nfunction isInsertionPoint( targetToCheck, ownerDocument ) {\n\tconst { defaultView } = ownerDocument;\n\n\treturn !! (\n\t\tdefaultView &&\n\t\ttargetToCheck instanceof defaultView.HTMLElement &&\n\t\ttargetToCheck.dataset.isInsertionPoint\n\t);\n}\n\n/**\n * @typedef {Object} WPBlockDropZoneConfig\n * @property {?HTMLElement} dropZoneElement Optional element to be used as the drop zone.\n * @property {string} rootClientId The root client id for the block list.\n */\n\n/**\n * A React hook that can be used to make a block list handle drag and drop.\n *\n * @param {WPBlockDropZoneConfig} dropZoneConfig configuration data for the drop zone.\n */\nexport default function useBlockDropZone( {\n\tdropZoneElement,\n\t// An undefined value represents a top-level block. Default to an empty\n\t// string for this so that `targetRootClientId` can be easily compared to\n\t// values returned by the `getRootBlockClientId` selector, which also uses\n\t// an empty string to represent top-level blocks.\n\trootClientId: targetRootClientId = '',\n\tparentClientId: parentBlockClientId = '',\n\tisDisabled = false,\n} = {} ) {\n\tconst registry = useRegistry();\n\tconst [ dropTarget, setDropTarget ] = useState( {\n\t\tindex: null,\n\t\toperation: 'insert',\n\t} );\n\n\tconst { getBlockType, getBlockVariations, getGroupingBlockName } =\n\t\tuseSelect( blocksStore );\n\tconst {\n\t\tcanInsertBlockType,\n\t\tgetBlockListSettings,\n\t\tgetBlocks,\n\t\tgetBlockIndex,\n\t\tgetDraggedBlockClientIds,\n\t\tgetBlockNamesByClientId,\n\t\tgetAllowedBlocks,\n\t\tisDragging,\n\t\tisGroupable,\n\t\tisZoomOutMode,\n\t\tgetSectionRootClientId,\n\t} = unlock( useSelect( blockEditorStore ) );\n\tconst {\n\t\tshowInsertionPoint,\n\t\thideInsertionPoint,\n\t\tstartDragging,\n\t\tstopDragging,\n\t} = unlock( useDispatch( blockEditorStore ) );\n\n\tconst onBlockDrop = useOnBlockDrop(\n\t\tdropTarget.operation === 'before' || dropTarget.operation === 'after'\n\t\t\t? parentBlockClientId\n\t\t\t: targetRootClientId,\n\t\tdropTarget.index,\n\t\t{\n\t\t\toperation: dropTarget.operation,\n\t\t\tnearestSide: dropTarget.nearestSide,\n\t\t}\n\t);\n\tconst throttled = useThrottle(\n\t\tuseCallback(\n\t\t\t( event, ownerDocument ) => {\n\t\t\t\tif ( ! isDragging() ) {\n\t\t\t\t\t// When dragging from the desktop, no drag start event is fired.\n\t\t\t\t\t// So, ensure that the drag state is set when the user drags over a drop zone.\n\t\t\t\t\tstartDragging();\n\t\t\t\t}\n\t\t\t\tconst allowedBlocks = getAllowedBlocks( targetRootClientId );\n\t\t\t\tconst targetBlockName = getBlockNamesByClientId( [\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t] )[ 0 ];\n\n\t\t\t\tconst draggedBlockNames = getBlockNamesByClientId(\n\t\t\t\t\tgetDraggedBlockClientIds()\n\t\t\t\t);\n\t\t\t\tconst isBlockDroppingAllowed = isDropTargetValid(\n\t\t\t\t\tgetBlockType,\n\t\t\t\t\tallowedBlocks,\n\t\t\t\t\tdraggedBlockNames,\n\t\t\t\t\ttargetBlockName\n\t\t\t\t);\n\n\t\t\t\tif ( ! isBlockDroppingAllowed ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst sectionRootClientId = getSectionRootClientId();\n\n\t\t\t\t// In Zoom Out mode, if the target is not the section root provided by settings then\n\t\t\t\t// do not allow dropping as the drop target is not within the root (that which is\n\t\t\t\t// treated as \"the content\" by Zoom Out Mode).\n\t\t\t\tif (\n\t\t\t\t\tisZoomOutMode() &&\n\t\t\t\t\tsectionRootClientId !== targetRootClientId\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst blocks = getBlocks( targetRootClientId );\n\n\t\t\t\t// The block list is empty, don't show the insertion point but still allow dropping.\n\t\t\t\tif ( blocks.length === 0 ) {\n\t\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t\tsetDropTarget( {\n\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\toperation: 'insert',\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tshowInsertionPoint( targetRootClientId, 0, {\n\t\t\t\t\t\t\toperation: 'insert',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst blocksData = blocks.map( ( block ) => {\n\t\t\t\t\tconst clientId = block.clientId;\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tisUnmodifiedDefaultBlock:\n\t\t\t\t\t\t\tgetIsUnmodifiedDefaultBlock( block ),\n\t\t\t\t\t\tgetBoundingClientRect: () =>\n\t\t\t\t\t\t\townerDocument\n\t\t\t\t\t\t\t\t.getElementById( `block-${ clientId }` )\n\t\t\t\t\t\t\t\t.getBoundingClientRect(),\n\t\t\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\t\t\tblockOrientation:\n\t\t\t\t\t\t\tgetBlockListSettings( clientId )?.orientation,\n\t\t\t\t\t};\n\t\t\t\t} );\n\n\t\t\t\tconst dropTargetPosition = getDropTargetPosition(\n\t\t\t\t\tblocksData,\n\t\t\t\t\t{ x: event.clientX, y: event.clientY },\n\t\t\t\t\tgetBlockListSettings( targetRootClientId )?.orientation,\n\t\t\t\t\t{\n\t\t\t\t\t\tdropZoneElement,\n\t\t\t\t\t\tparentBlockClientId,\n\t\t\t\t\t\tparentBlockOrientation: parentBlockClientId\n\t\t\t\t\t\t\t? getBlockListSettings( parentBlockClientId )\n\t\t\t\t\t\t\t\t\t?.orientation\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\trootBlockIndex: getBlockIndex( targetRootClientId ),\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tconst [ targetIndex, operation, nearestSide ] =\n\t\t\t\t\tdropTargetPosition;\n\n\t\t\t\tif ( isZoomOutMode() && operation !== 'insert' ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( operation === 'group' ) {\n\t\t\t\t\tconst targetBlock = blocks[ targetIndex ];\n\t\t\t\t\tconst areAllImages = [\n\t\t\t\t\t\ttargetBlock.name,\n\t\t\t\t\t\t...draggedBlockNames,\n\t\t\t\t\t].every( ( name ) => name === 'core/image' );\n\t\t\t\t\tconst canInsertGalleryBlock = canInsertBlockType(\n\t\t\t\t\t\t'core/gallery',\n\t\t\t\t\t\ttargetRootClientId\n\t\t\t\t\t);\n\t\t\t\t\tconst areGroupableBlocks = isGroupable( [\n\t\t\t\t\t\ttargetBlock.clientId,\n\t\t\t\t\t\tgetDraggedBlockClientIds(),\n\t\t\t\t\t] );\n\t\t\t\t\tconst groupBlockVariations = getBlockVariations(\n\t\t\t\t\t\tgetGroupingBlockName(),\n\t\t\t\t\t\t'block'\n\t\t\t\t\t);\n\t\t\t\t\tconst canInsertRow =\n\t\t\t\t\t\tgroupBlockVariations &&\n\t\t\t\t\t\tgroupBlockVariations.find(\n\t\t\t\t\t\t\t( { name } ) => name === 'group-row'\n\t\t\t\t\t\t);\n\n\t\t\t\t\t// If the dragged blocks and the target block are all images,\n\t\t\t\t\t// check if it is creatable either a Row variation or a Gallery block.\n\t\t\t\t\tif (\n\t\t\t\t\t\tareAllImages &&\n\t\t\t\t\t\t! canInsertGalleryBlock &&\n\t\t\t\t\t\t( ! areGroupableBlocks || ! canInsertRow )\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t// If the dragged blocks and the target block are not all images,\n\t\t\t\t\t// check if it is creatable a Row variation.\n\t\t\t\t\tif (\n\t\t\t\t\t\t! areAllImages &&\n\t\t\t\t\t\t( ! areGroupableBlocks || ! canInsertRow )\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\tsetDropTarget( {\n\t\t\t\t\t\tindex: targetIndex,\n\t\t\t\t\t\toperation,\n\t\t\t\t\t\tnearestSide,\n\t\t\t\t\t} );\n\n\t\t\t\t\tconst insertionPointClientId = [\n\t\t\t\t\t\t'before',\n\t\t\t\t\t\t'after',\n\t\t\t\t\t].includes( operation )\n\t\t\t\t\t\t? parentBlockClientId\n\t\t\t\t\t\t: targetRootClientId;\n\n\t\t\t\t\tshowInsertionPoint( insertionPointClientId, targetIndex, {\n\t\t\t\t\t\toperation,\n\t\t\t\t\t\tnearestSide,\n\t\t\t\t\t} );\n\t\t\t\t} );\n\t\t\t},\n\t\t\t[\n\t\t\t\tisDragging,\n\t\t\t\tgetAllowedBlocks,\n\t\t\t\ttargetRootClientId,\n\t\t\t\tgetBlockNamesByClientId,\n\t\t\t\tgetDraggedBlockClientIds,\n\t\t\t\tgetBlockType,\n\t\t\t\tgetSectionRootClientId,\n\t\t\t\tisZoomOutMode,\n\t\t\t\tgetBlocks,\n\t\t\t\tgetBlockListSettings,\n\t\t\t\tdropZoneElement,\n\t\t\t\tparentBlockClientId,\n\t\t\t\tgetBlockIndex,\n\t\t\t\tregistry,\n\t\t\t\tstartDragging,\n\t\t\t\tshowInsertionPoint,\n\t\t\t\tcanInsertBlockType,\n\t\t\t\tisGroupable,\n\t\t\t\tgetBlockVariations,\n\t\t\t\tgetGroupingBlockName,\n\t\t\t]\n\t\t),\n\t\t200\n\t);\n\n\treturn useDropZone( {\n\t\tdropZoneElement,\n\t\tisDisabled,\n\t\tonDrop: onBlockDrop,\n\t\tonDragOver( event ) {\n\t\t\t// `currentTarget` is only available while the event is being\n\t\t\t// handled, so get it now and pass it to the thottled function.\n\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget\n\t\t\tthrottled( event, event.currentTarget.ownerDocument );\n\t\t},\n\t\tonDragLeave( event ) {\n\t\t\tconst { ownerDocument } = event.currentTarget;\n\n\t\t\t// If the drag event is leaving the drop zone and entering an insertion point,\n\t\t\t// do not hide the insertion point as it is conceptually within the dropzone.\n\t\t\tif (\n\t\t\t\tisInsertionPoint( event.relatedTarget, ownerDocument ) ||\n\t\t\t\tisInsertionPoint( event.target, ownerDocument )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthrottled.cancel();\n\t\t\thideInsertionPoint();\n\t\t},\n\t\tonDragEnd() {\n\t\t\tthrottled.cancel();\n\t\t\tstopDragging();\n\t\t\thideInsertionPoint();\n\t\t},\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAAS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ACf8C,mBAAmB,EACnBY,aAAa,EACbV,QAAQ,EACRoB,aAAa,EACbF,kBAAkB,EAClBX,kBAAkB,EAClBQ,WAAW,EACXV,kBAAkB,EAClBC,oBAAoB,CAEtB,CAAC,EACD,GACD,CAAC;EAED,OAAOjF,WAAW,CAAE;IACnB2B,eAAe;IACf+C,UAAU;IACVgD,MAAM,EAAEzB,WAAW;IACnB0B,UAAUA,CAAExB,KAAK,EAAG;MACnB;MACA;MACA;MACAD,SAAS,CAAEC,KAAK,EAAEA,KAAK,CAACyB,aAAa,CAAC3D,aAAc,CAAC;IACtD,CAAC;IACD4D,WAAWA,CAAE1B,KAAK,EAAG;MACpB,MAAM;QAAElC;MAAc,CAAC,GAAGkC,KAAK,CAACyB,aAAa;;MAE7C;MACA;MACA,IACC7D,gBAAgB,CAAEoC,KAAK,CAAC2B,aAAa,EAAE7D,aAAc,CAAC,IACtDF,gBAAgB,CAAEoC,KAAK,CAAC4B,MAAM,EAAE9D,aAAc,CAAC,EAC9C;QACD;MACD;MAEAiC,SAAS,CAAC8B,MAAM,CAAC,CAAC;MAClBlC,kBAAkB,CAAC,CAAC;IACrB,CAAC;IACDmC,SAASA,CAAA,EAAG;MACX/B,SAAS,CAAC8B,MAAM,CAAC,CAAC;MAClBhC,YAAY,CAAC,CAAC;MACdF,kBAAkB,CAAC,CAAC;IACrB;EACD,CAAE,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["useDispatch","useSelect","useRegistry","useCallback","useState","useThrottle","__experimentalUseDropZone","useDropZone","isRTL","isUnmodifiedDefaultBlock","getIsUnmodifiedDefaultBlock","store","blocksStore","useOnBlockDrop","getDistanceToNearestEdge","isPointContainedByRect","isPointWithinTopAndBottomBoundariesOfRect","blockEditorStore","unlock","THRESHOLD_DISTANCE","MINIMUM_HEIGHT_FOR_THRESHOLD","MINIMUM_WIDTH_FOR_THRESHOLD","getDropTargetPosition","blocksData","position","orientation","options","allowedEdges","nearestIndex","insertPosition","minDistance","Infinity","targetBlockIndex","nearestSide","dropZoneElement","parentBlockOrientation","rootBlockIndex","rect","getBoundingClientRect","distance","edge","height","isRightToLeft","width","forEach","blockIndex","blockOrientation","sideDistance","sideEdge","isPointInsideRect","adjacentIndex","isNearestBlockUnmodifiedDefaultBlock","isAdjacentBlockUnmodifiedDefaultBlock","insertionIndex","isDropTargetValid","getBlockType","allowedBlocks","draggedBlockNames","targetBlockName","areBlocksAllowed","allowedBlockNames","map","name","every","includes","draggedBlockTypes","targetMatchesDraggedBlockParents","block","allowedParentName","parent","isInsertionPoint","targetToCheck","ownerDocument","defaultView","HTMLElement","closest","useBlockDropZone","rootClientId","targetRootClientId","parentClientId","parentBlockClientId","isDisabled","registry","dropTarget","setDropTarget","index","operation","getBlockVariations","getGroupingBlockName","canInsertBlockType","getBlockListSettings","getBlocks","getBlockIndex","getDraggedBlockClientIds","getBlockNamesByClientId","getAllowedBlocks","isDragging","isGroupable","isZoomOut","getSectionRootClientId","showInsertionPoint","hideInsertionPoint","startDragging","stopDragging","onBlockDrop","throttled","event","isBlockDroppingAllowed","sectionRootClientId","blocks","length","batch","clientId","getElementById","dropTargetPosition","x","clientX","y","clientY","undefined","targetIndex","targetBlock","areAllImages","canInsertGalleryBlock","areGroupableBlocks","groupBlockVariations","canInsertRow","find","insertionPointClientId","onDrop","onDragOver","currentTarget","onDragLeave","relatedTarget","target","cancel","onDragEnd"],"sources":["@wordpress/block-editor/src/components/use-block-drop-zone/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { useCallback, useState } from '@wordpress/element';\nimport {\n\tuseThrottle,\n\t__experimentalUseDropZone as useDropZone,\n} from '@wordpress/compose';\nimport { isRTL } from '@wordpress/i18n';\nimport {\n\tisUnmodifiedDefaultBlock as getIsUnmodifiedDefaultBlock,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport useOnBlockDrop from '../use-on-block-drop';\nimport {\n\tgetDistanceToNearestEdge,\n\tisPointContainedByRect,\n\tisPointWithinTopAndBottomBoundariesOfRect,\n} from '../../utils/math';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst THRESHOLD_DISTANCE = 30;\nconst MINIMUM_HEIGHT_FOR_THRESHOLD = 120;\nconst MINIMUM_WIDTH_FOR_THRESHOLD = 120;\n\n/** @typedef {import('../../utils/math').WPPoint} WPPoint */\n/** @typedef {import('../use-on-block-drop/types').WPDropOperation} WPDropOperation */\n\n/**\n * The orientation of a block list.\n *\n * @typedef {'horizontal'|'vertical'|undefined} WPBlockListOrientation\n */\n\n/**\n * The insert position when dropping a block.\n *\n * @typedef {'before'|'after'} WPInsertPosition\n */\n\n/**\n * @typedef {Object} WPBlockData\n * @property {boolean} isUnmodifiedDefaultBlock Is the block unmodified default block.\n * @property {() => DOMRect} getBoundingClientRect Get the bounding client rect of the block.\n * @property {number} blockIndex The index of the block.\n */\n\n/**\n * Get the drop target position from a given drop point and the orientation.\n *\n * @param {WPBlockData[]} blocksData The block data list.\n * @param {WPPoint} position The position of the item being dragged.\n * @param {WPBlockListOrientation} orientation The orientation of the block list.\n * @param {Object} options Additional options.\n * @return {[number, WPDropOperation]} The drop target position.\n */\nexport function getDropTargetPosition(\n\tblocksData,\n\tposition,\n\torientation = 'vertical',\n\toptions = {}\n) {\n\tconst allowedEdges =\n\t\torientation === 'horizontal'\n\t\t\t? [ 'left', 'right' ]\n\t\t\t: [ 'top', 'bottom' ];\n\n\tlet nearestIndex = 0;\n\tlet insertPosition = 'before';\n\tlet minDistance = Infinity;\n\tlet targetBlockIndex = null;\n\tlet nearestSide = 'right';\n\n\tconst {\n\t\tdropZoneElement,\n\t\tparentBlockOrientation,\n\t\trootBlockIndex = 0,\n\t} = options;\n\n\t// Allow before/after when dragging over the top/bottom edges of the drop zone.\n\tif ( dropZoneElement && parentBlockOrientation !== 'horizontal' ) {\n\t\tconst rect = dropZoneElement.getBoundingClientRect();\n\t\tconst [ distance, edge ] = getDistanceToNearestEdge( position, rect, [\n\t\t\t'top',\n\t\t\t'bottom',\n\t\t] );\n\n\t\t// If dragging over the top or bottom of the drop zone, insert the block\n\t\t// before or after the parent block. This only applies to blocks that use\n\t\t// a drop zone element, typically container blocks such as Group or Cover.\n\t\tif (\n\t\t\trect.height > MINIMUM_HEIGHT_FOR_THRESHOLD &&\n\t\t\tdistance < THRESHOLD_DISTANCE\n\t\t) {\n\t\t\tif ( edge === 'top' ) {\n\t\t\t\treturn [ rootBlockIndex, 'before' ];\n\t\t\t}\n\t\t\tif ( edge === 'bottom' ) {\n\t\t\t\treturn [ rootBlockIndex + 1, 'after' ];\n\t\t\t}\n\t\t}\n\t}\n\n\tconst isRightToLeft = isRTL();\n\n\t// Allow before/after when dragging over the left/right edges of the drop zone.\n\tif ( dropZoneElement && parentBlockOrientation === 'horizontal' ) {\n\t\tconst rect = dropZoneElement.getBoundingClientRect();\n\t\tconst [ distance, edge ] = getDistanceToNearestEdge( position, rect, [\n\t\t\t'left',\n\t\t\t'right',\n\t\t] );\n\n\t\t// If dragging over the left or right of the drop zone, insert the block\n\t\t// before or after the parent block. This only applies to blocks that use\n\t\t// a drop zone element, typically container blocks such as Group.\n\t\tif (\n\t\t\trect.width > MINIMUM_WIDTH_FOR_THRESHOLD &&\n\t\t\tdistance < THRESHOLD_DISTANCE\n\t\t) {\n\t\t\tif (\n\t\t\t\t( isRightToLeft && edge === 'right' ) ||\n\t\t\t\t( ! isRightToLeft && edge === 'left' )\n\t\t\t) {\n\t\t\t\treturn [ rootBlockIndex, 'before' ];\n\t\t\t}\n\t\t\tif (\n\t\t\t\t( isRightToLeft && edge === 'left' ) ||\n\t\t\t\t( ! isRightToLeft && edge === 'right' )\n\t\t\t) {\n\t\t\t\treturn [ rootBlockIndex + 1, 'after' ];\n\t\t\t}\n\t\t}\n\t}\n\n\tblocksData.forEach(\n\t\t( {\n\t\t\tisUnmodifiedDefaultBlock,\n\t\t\tgetBoundingClientRect,\n\t\t\tblockIndex,\n\t\t\tblockOrientation,\n\t\t} ) => {\n\t\t\tconst rect = getBoundingClientRect();\n\n\t\t\tlet [ distance, edge ] = getDistanceToNearestEdge(\n\t\t\t\tposition,\n\t\t\t\trect,\n\t\t\t\tallowedEdges\n\t\t\t);\n\t\t\t// If the the point is close to a side, prioritize that side.\n\t\t\tconst [ sideDistance, sideEdge ] = getDistanceToNearestEdge(\n\t\t\t\tposition,\n\t\t\t\trect,\n\t\t\t\t[ 'left', 'right' ]\n\t\t\t);\n\n\t\t\tconst isPointInsideRect = isPointContainedByRect( position, rect );\n\n\t\t\t// Prioritize the element if the point is inside of an unmodified default block.\n\t\t\tif ( isUnmodifiedDefaultBlock && isPointInsideRect ) {\n\t\t\t\tdistance = 0;\n\t\t\t} else if (\n\t\t\t\torientation === 'vertical' &&\n\t\t\t\tblockOrientation !== 'horizontal' &&\n\t\t\t\t( ( isPointInsideRect && sideDistance < THRESHOLD_DISTANCE ) ||\n\t\t\t\t\t( ! isPointInsideRect &&\n\t\t\t\t\t\tisPointWithinTopAndBottomBoundariesOfRect(\n\t\t\t\t\t\t\tposition,\n\t\t\t\t\t\t\trect\n\t\t\t\t\t\t) ) )\n\t\t\t) {\n\t\t\t\t/**\n\t\t\t\t * This condition should only apply when the layout is vertical (otherwise there's\n\t\t\t\t * no need to create a Row) and dropzones should only activate when the block is\n\t\t\t\t * either within and close to the sides of the target block or on its outer sides.\n\t\t\t\t */\n\t\t\t\ttargetBlockIndex = blockIndex;\n\t\t\t\tnearestSide = sideEdge;\n\t\t\t}\n\n\t\t\tif ( distance < minDistance ) {\n\t\t\t\t// Where the dropped block will be inserted on the nearest block.\n\t\t\t\tinsertPosition =\n\t\t\t\t\tedge === 'bottom' ||\n\t\t\t\t\t( ! isRightToLeft && edge === 'right' ) ||\n\t\t\t\t\t( isRightToLeft && edge === 'left' )\n\t\t\t\t\t\t? 'after'\n\t\t\t\t\t\t: 'before';\n\n\t\t\t\t// Update the currently known best candidate.\n\t\t\t\tminDistance = distance;\n\t\t\t\tnearestIndex = blockIndex;\n\t\t\t}\n\t\t}\n\t);\n\n\tconst adjacentIndex =\n\t\tnearestIndex + ( insertPosition === 'after' ? 1 : -1 );\n\tconst isNearestBlockUnmodifiedDefaultBlock =\n\t\t!! blocksData[ nearestIndex ]?.isUnmodifiedDefaultBlock;\n\tconst isAdjacentBlockUnmodifiedDefaultBlock =\n\t\t!! blocksData[ adjacentIndex ]?.isUnmodifiedDefaultBlock;\n\n\t// If the target index is set then group with the block at that index.\n\tif ( targetBlockIndex !== null ) {\n\t\treturn [ targetBlockIndex, 'group', nearestSide ];\n\t}\n\t// If both blocks are not unmodified default blocks then just insert between them.\n\tif (\n\t\t! isNearestBlockUnmodifiedDefaultBlock &&\n\t\t! isAdjacentBlockUnmodifiedDefaultBlock\n\t) {\n\t\t// If the user is dropping to the trailing edge of the block\n\t\t// add 1 to the index to represent dragging after.\n\t\tconst insertionIndex =\n\t\t\tinsertPosition === 'after' ? nearestIndex + 1 : nearestIndex;\n\t\treturn [ insertionIndex, 'insert' ];\n\t}\n\n\t// Otherwise, replace the nearest unmodified default block.\n\treturn [\n\t\tisNearestBlockUnmodifiedDefaultBlock ? nearestIndex : adjacentIndex,\n\t\t'replace',\n\t];\n}\n\n/**\n * Check if the dragged blocks can be dropped on the target.\n * @param {Function} getBlockType\n * @param {Object[]} allowedBlocks\n * @param {string[]} draggedBlockNames\n * @param {string} targetBlockName\n * @return {boolean} Whether the dragged blocks can be dropped on the target.\n */\nexport function isDropTargetValid(\n\tgetBlockType,\n\tallowedBlocks,\n\tdraggedBlockNames,\n\ttargetBlockName\n) {\n\t// At root level allowedBlocks is undefined and all blocks are allowed.\n\t// Otherwise, check if all dragged blocks are allowed.\n\tlet areBlocksAllowed = true;\n\tif ( allowedBlocks ) {\n\t\tconst allowedBlockNames = allowedBlocks?.map( ( { name } ) => name );\n\n\t\tareBlocksAllowed = draggedBlockNames.every( ( name ) =>\n\t\t\tallowedBlockNames?.includes( name )\n\t\t);\n\t}\n\n\t// Work out if dragged blocks have an allowed parent and if so\n\t// check target block matches the allowed parent.\n\tconst draggedBlockTypes = draggedBlockNames.map( ( name ) =>\n\t\tgetBlockType( name )\n\t);\n\tconst targetMatchesDraggedBlockParents = draggedBlockTypes.every(\n\t\t( block ) => {\n\t\t\tconst [ allowedParentName ] = block?.parent || [];\n\t\t\tif ( ! allowedParentName ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn allowedParentName === targetBlockName;\n\t\t}\n\t);\n\n\treturn areBlocksAllowed && targetMatchesDraggedBlockParents;\n}\n\n/**\n * Checks if the given element is an insertion point.\n *\n * @param {EventTarget|null} targetToCheck - The element to check.\n * @param {Document} ownerDocument - The owner document of the element.\n * @return {boolean} True if the element is a insertion point, false otherwise.\n */\nfunction isInsertionPoint( targetToCheck, ownerDocument ) {\n\tconst { defaultView } = ownerDocument;\n\n\treturn !! (\n\t\tdefaultView &&\n\t\ttargetToCheck instanceof defaultView.HTMLElement &&\n\t\ttargetToCheck.closest( '[data-is-insertion-point]' )\n\t);\n}\n\n/**\n * @typedef {Object} WPBlockDropZoneConfig\n * @property {?HTMLElement} dropZoneElement Optional element to be used as the drop zone.\n * @property {string} rootClientId The root client id for the block list.\n */\n\n/**\n * A React hook that can be used to make a block list handle drag and drop.\n *\n * @param {WPBlockDropZoneConfig} dropZoneConfig configuration data for the drop zone.\n */\nexport default function useBlockDropZone( {\n\tdropZoneElement,\n\t// An undefined value represents a top-level block. Default to an empty\n\t// string for this so that `targetRootClientId` can be easily compared to\n\t// values returned by the `getRootBlockClientId` selector, which also uses\n\t// an empty string to represent top-level blocks.\n\trootClientId: targetRootClientId = '',\n\tparentClientId: parentBlockClientId = '',\n\tisDisabled = false,\n} = {} ) {\n\tconst registry = useRegistry();\n\tconst [ dropTarget, setDropTarget ] = useState( {\n\t\tindex: null,\n\t\toperation: 'insert',\n\t} );\n\n\tconst { getBlockType, getBlockVariations, getGroupingBlockName } =\n\t\tuseSelect( blocksStore );\n\tconst {\n\t\tcanInsertBlockType,\n\t\tgetBlockListSettings,\n\t\tgetBlocks,\n\t\tgetBlockIndex,\n\t\tgetDraggedBlockClientIds,\n\t\tgetBlockNamesByClientId,\n\t\tgetAllowedBlocks,\n\t\tisDragging,\n\t\tisGroupable,\n\t\tisZoomOut,\n\t\tgetSectionRootClientId,\n\t} = unlock( useSelect( blockEditorStore ) );\n\tconst {\n\t\tshowInsertionPoint,\n\t\thideInsertionPoint,\n\t\tstartDragging,\n\t\tstopDragging,\n\t} = unlock( useDispatch( blockEditorStore ) );\n\n\tconst onBlockDrop = useOnBlockDrop(\n\t\tdropTarget.operation === 'before' || dropTarget.operation === 'after'\n\t\t\t? parentBlockClientId\n\t\t\t: targetRootClientId,\n\t\tdropTarget.index,\n\t\t{\n\t\t\toperation: dropTarget.operation,\n\t\t\tnearestSide: dropTarget.nearestSide,\n\t\t}\n\t);\n\tconst throttled = useThrottle(\n\t\tuseCallback(\n\t\t\t( event, ownerDocument ) => {\n\t\t\t\tif ( ! isDragging() ) {\n\t\t\t\t\t// When dragging from the desktop, no drag start event is fired.\n\t\t\t\t\t// So, ensure that the drag state is set when the user drags over a drop zone.\n\t\t\t\t\tstartDragging();\n\t\t\t\t}\n\t\t\t\tconst allowedBlocks = getAllowedBlocks( targetRootClientId );\n\t\t\t\tconst targetBlockName = getBlockNamesByClientId( [\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t] )[ 0 ];\n\n\t\t\t\tconst draggedBlockNames = getBlockNamesByClientId(\n\t\t\t\t\tgetDraggedBlockClientIds()\n\t\t\t\t);\n\t\t\t\tconst isBlockDroppingAllowed = isDropTargetValid(\n\t\t\t\t\tgetBlockType,\n\t\t\t\t\tallowedBlocks,\n\t\t\t\t\tdraggedBlockNames,\n\t\t\t\t\ttargetBlockName\n\t\t\t\t);\n\n\t\t\t\tif ( ! isBlockDroppingAllowed ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst sectionRootClientId = getSectionRootClientId();\n\n\t\t\t\t// In Zoom Out mode, if the target is not the section root provided by settings then\n\t\t\t\t// do not allow dropping as the drop target is not within the root (that which is\n\t\t\t\t// treated as \"the content\" by Zoom Out Mode).\n\t\t\t\tif (\n\t\t\t\t\tisZoomOut() &&\n\t\t\t\t\tsectionRootClientId !== targetRootClientId\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst blocks = getBlocks( targetRootClientId );\n\n\t\t\t\t// The block list is empty, don't show the insertion point but still allow dropping.\n\t\t\t\tif ( blocks.length === 0 ) {\n\t\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t\tsetDropTarget( {\n\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\toperation: 'insert',\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tshowInsertionPoint( targetRootClientId, 0, {\n\t\t\t\t\t\t\toperation: 'insert',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst blocksData = blocks.map( ( block ) => {\n\t\t\t\t\tconst clientId = block.clientId;\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tisUnmodifiedDefaultBlock:\n\t\t\t\t\t\t\tgetIsUnmodifiedDefaultBlock( block ),\n\t\t\t\t\t\tgetBoundingClientRect: () =>\n\t\t\t\t\t\t\townerDocument\n\t\t\t\t\t\t\t\t.getElementById( `block-${ clientId }` )\n\t\t\t\t\t\t\t\t.getBoundingClientRect(),\n\t\t\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\t\t\tblockOrientation:\n\t\t\t\t\t\t\tgetBlockListSettings( clientId )?.orientation,\n\t\t\t\t\t};\n\t\t\t\t} );\n\n\t\t\t\tconst dropTargetPosition = getDropTargetPosition(\n\t\t\t\t\tblocksData,\n\t\t\t\t\t{ x: event.clientX, y: event.clientY },\n\t\t\t\t\tgetBlockListSettings( targetRootClientId )?.orientation,\n\t\t\t\t\t{\n\t\t\t\t\t\tdropZoneElement,\n\t\t\t\t\t\tparentBlockClientId,\n\t\t\t\t\t\tparentBlockOrientation: parentBlockClientId\n\t\t\t\t\t\t\t? getBlockListSettings( parentBlockClientId )\n\t\t\t\t\t\t\t\t\t?.orientation\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\trootBlockIndex: getBlockIndex( targetRootClientId ),\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tconst [ targetIndex, operation, nearestSide ] =\n\t\t\t\t\tdropTargetPosition;\n\n\t\t\t\tif ( isZoomOut() && operation !== 'insert' ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( operation === 'group' ) {\n\t\t\t\t\tconst targetBlock = blocks[ targetIndex ];\n\t\t\t\t\tconst areAllImages = [\n\t\t\t\t\t\ttargetBlock.name,\n\t\t\t\t\t\t...draggedBlockNames,\n\t\t\t\t\t].every( ( name ) => name === 'core/image' );\n\t\t\t\t\tconst canInsertGalleryBlock = canInsertBlockType(\n\t\t\t\t\t\t'core/gallery',\n\t\t\t\t\t\ttargetRootClientId\n\t\t\t\t\t);\n\t\t\t\t\tconst areGroupableBlocks = isGroupable( [\n\t\t\t\t\t\ttargetBlock.clientId,\n\t\t\t\t\t\tgetDraggedBlockClientIds(),\n\t\t\t\t\t] );\n\t\t\t\t\tconst groupBlockVariations = getBlockVariations(\n\t\t\t\t\t\tgetGroupingBlockName(),\n\t\t\t\t\t\t'block'\n\t\t\t\t\t);\n\t\t\t\t\tconst canInsertRow =\n\t\t\t\t\t\tgroupBlockVariations &&\n\t\t\t\t\t\tgroupBlockVariations.find(\n\t\t\t\t\t\t\t( { name } ) => name === 'group-row'\n\t\t\t\t\t\t);\n\n\t\t\t\t\t// If the dragged blocks and the target block are all images,\n\t\t\t\t\t// check if it is creatable either a Row variation or a Gallery block.\n\t\t\t\t\tif (\n\t\t\t\t\t\tareAllImages &&\n\t\t\t\t\t\t! canInsertGalleryBlock &&\n\t\t\t\t\t\t( ! areGroupableBlocks || ! canInsertRow )\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t// If the dragged blocks and the target block are not all images,\n\t\t\t\t\t// check if it is creatable a Row variation.\n\t\t\t\t\tif (\n\t\t\t\t\t\t! areAllImages &&\n\t\t\t\t\t\t( ! areGroupableBlocks || ! canInsertRow )\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\tsetDropTarget( {\n\t\t\t\t\t\tindex: targetIndex,\n\t\t\t\t\t\toperation,\n\t\t\t\t\t\tnearestSide,\n\t\t\t\t\t} );\n\n\t\t\t\t\tconst insertionPointClientId = [\n\t\t\t\t\t\t'before',\n\t\t\t\t\t\t'after',\n\t\t\t\t\t].includes( operation )\n\t\t\t\t\t\t? parentBlockClientId\n\t\t\t\t\t\t: targetRootClientId;\n\n\t\t\t\t\tshowInsertionPoint( insertionPointClientId, targetIndex, {\n\t\t\t\t\t\toperation,\n\t\t\t\t\t\tnearestSide,\n\t\t\t\t\t} );\n\t\t\t\t} );\n\t\t\t},\n\t\t\t[\n\t\t\t\tisDragging,\n\t\t\t\tgetAllowedBlocks,\n\t\t\t\ttargetRootClientId,\n\t\t\t\tgetBlockNamesByClientId,\n\t\t\t\tgetDraggedBlockClientIds,\n\t\t\t\tgetBlockType,\n\t\t\t\tgetSectionRootClientId,\n\t\t\t\tisZoomOut,\n\t\t\t\tgetBlocks,\n\t\t\t\tgetBlockListSettings,\n\t\t\t\tdropZoneElement,\n\t\t\t\tparentBlockClientId,\n\t\t\t\tgetBlockIndex,\n\t\t\t\tregistry,\n\t\t\t\tstartDragging,\n\t\t\t\tshowInsertionPoint,\n\t\t\t\tcanInsertBlockType,\n\t\t\t\tisGroupable,\n\t\t\t\tgetBlockVariations,\n\t\t\t\tgetGroupingBlockName,\n\t\t\t]\n\t\t),\n\t\t200\n\t);\n\n\treturn useDropZone( {\n\t\tdropZoneElement,\n\t\tisDisabled,\n\t\tonDrop: onBlockDrop,\n\t\tonDragOver( event ) {\n\t\t\t// `currentTarget` is only available while the event is being\n\t\t\t// handled, so get it now and pass it to the thottled function.\n\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget\n\t\t\tthrottled( event, event.currentTarget.ownerDocument );\n\t\t},\n\t\tonDragLeave( event ) {\n\t\t\tconst { ownerDocument } = event.currentTarget;\n\n\t\t\t// If the drag event is leaving the drop zone and entering an insertion point,\n\t\t\t// do not hide the insertion point as it is conceptually within the dropzone.\n\t\t\tif (\n\t\t\t\tisInsertionPoint( event.relatedTarget, ownerDocument ) ||\n\t\t\t\tisInsertionPoint( event.target, ownerDocument )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthrottled.cancel();\n\t\t\thideInsertionPoint();\n\t\t},\n\t\tonDragEnd() {\n\t\t\tthrottled.cancel();\n\t\t\tstopDragging();\n\t\t\thideInsertionPoint();\n\t\t},\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACrE,SAASC,WAAW,EAAEC,QAAQ,QAAQ,oBAAoB;AAC1D,SACCC,WAAW,EACXC,yBAAyB,IAAIC,WAAW,QAClC,oBAAoB;AAC3B,SAASC,KAAK,QAAQ,iBAAiB;AACvC,SACCC,wBAAwB,IAAIC,2BAA2B,EACvDC,KAAK,IAAIC,WAAW,QACd,mBAAmB;;AAE1B;AACA;AACA;AACA,OAAOC,cAAc,MAAM,sBAAsB;AACjD,SACCC,wBAAwB,EACxBC,sBAAsB,EACtBC,yCAAyC,QACnC,kBAAkB;AACzB,SAASL,KAAK,IAAIM,gBAAgB,QAAQ,aAAa;AACvD,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAMC,kBAAkB,GAAG,EAAE;AAC7B,MAAMC,4BAA4B,GAAG,GAAG;AACxC,M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D,aAAc,CAAC,IACtDF,gBAAgB,CAAEoC,KAAK,CAAC4B,MAAM,EAAE9D,aAAc,CAAC,EAC9C;QACD;MACD;MAEAiC,SAAS,CAAC8B,MAAM,CAAC,CAAC;MAClBlC,kBAAkB,CAAC,CAAC;IACrB,CAAC;IACDmC,SAASA,CAAA,EAAG;MACX/B,SAAS,CAAC8B,MAAM,CAAC,CAAC;MAClBhC,YAAY,CAAC,CAAC;MACdF,kBAAkB,CAAC,CAAC;IACrB;EACD,CAAE,CAAC;AACJ","ignoreList":[]}
@@ -117,7 +117,6 @@ export default function useBlockDropZone({
117
117
  const getSortedBlocksLayouts = useCallback(() => {
118
118
  return getBlockLayoutsOrderedByYCoord(blocksLayouts.current);
119
119
  // We use the value of `blocksLayouts` as the dependency.
120
- // eslint-disable-next-line react-hooks/exhaustive-deps
121
120
  }, [blocksLayouts.current]);
122
121
  const isRTL = getSettings().isRTL;
123
122
  const onBlockDrop = useOnBlockDrop();
@@ -1 +1 @@
1
- {"version":3,"names":["runOnJS","useDerivedValue","useSharedValue","useSelect","useCallback","store","blockEditorStore","useBlockListContext","getDistanceToNearestEdge","useOnBlockDrop","UPDATE_TARGET_BLOCK_INDEX_THRESHOLD","getNearestBlockIndex","blocksLayouts","position","orientation","isRTL","allowedEdges","isRightToLeft","candidateIndex","candidateDistance","forEach","element","index","x","y","width","height","rect","top","right","bottom","left","distance","edge","undefined","isTrailingEdge","offset","useBlockDropZone","rootClientId","targetRootClientId","targetBlockIndex","dragPosition","prevDragPosition","getBlockListSettings","getSettings","getBlockLayoutsOrderedByYCoord","getSortedBlocksLayouts","current","onBlockDrop","updateTargetBlockIndex","event","sortedBlockLayouts","targetIndex","value","prevX","prevY","Math","abs","onBlockDragOver","onBlockDragOverWorklet","onBlockDragEnd"],"sources":["@wordpress/block-editor/src/components/use-block-drop-zone/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport {\n\trunOnJS,\n\tuseDerivedValue,\n\tuseSharedValue,\n} from 'react-native-reanimated';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useBlockListContext } from '../block-list/block-list-context';\nimport { getDistanceToNearestEdge } from '../../utils/math';\nimport useOnBlockDrop from '../use-on-block-drop';\n\nconst UPDATE_TARGET_BLOCK_INDEX_THRESHOLD = 20; // In pixels\n\n/** @typedef {import('../../utils/math').WPPoint} WPPoint */\n\n/**\n * The orientation of a block list.\n *\n * @typedef {'horizontal'|'vertical'|undefined} WPBlockListOrientation\n */\n\n/**\n * Given a list of blocks layouts finds the index that a block should be dropped at.\n *\n * @param {Object} blocksLayouts Blocks layouts object.\n * @param {WPPoint} position The position of the item being dragged.\n * @param {WPBlockListOrientation} orientation The orientation of a block list.\n * @param {boolean} isRTL Check if current locale is RTL.\n *\n * @return {number|undefined} The block index that's closest to the drag position.\n */\nexport function getNearestBlockIndex(\n\tblocksLayouts,\n\tposition,\n\torientation,\n\tisRTL\n) {\n\tconst allowedEdges =\n\t\torientation === 'horizontal'\n\t\t\t? [ 'left', 'right' ]\n\t\t\t: [ 'top', 'bottom' ];\n\n\tconst isRightToLeft = isRTL;\n\n\tlet candidateIndex;\n\tlet candidateDistance;\n\n\t// Only enabled for root level blocks.\n\tblocksLayouts.forEach( ( element, index ) => {\n\t\tconst { x, y, width, height } = element;\n\t\tconst rect = {\n\t\t\tx: element.x,\n\t\t\ty: element.y,\n\t\t\ttop: y,\n\t\t\tright: x + width,\n\t\t\tbottom: y + height,\n\t\t\tleft: x,\n\t\t\twidth,\n\t\t\theight,\n\t\t};\n\t\tconst [ distance, edge ] = getDistanceToNearestEdge(\n\t\t\tposition,\n\t\t\trect,\n\t\t\tallowedEdges\n\t\t);\n\n\t\tif ( candidateDistance === undefined || distance < candidateDistance ) {\n\t\t\t// If the user is dropping to the trailing edge of the block\n\t\t\t// add 1 to the index to represent dragging after.\n\t\t\t// Take RTL languages into account where the left edge is\n\t\t\t// the trailing edge.\n\t\t\tconst isTrailingEdge =\n\t\t\t\tedge === 'bottom' ||\n\t\t\t\t( ! isRightToLeft && edge === 'right' ) ||\n\t\t\t\t( isRightToLeft && edge === 'left' );\n\t\t\tconst offset = isTrailingEdge ? 1 : 0;\n\n\t\t\t// Update the currently known best candidate.\n\t\t\tcandidateDistance = distance;\n\t\t\tcandidateIndex = index + offset;\n\t\t}\n\t} );\n\treturn candidateIndex;\n}\n\n/**\n * @typedef {Object} WPBlockDropZoneConfig\n * @property {string} rootClientId The root client id for the block list.\n */\n\n/**\n * A React hook that can be used to make a block list handle drag and drop.\n *\n * @param {WPBlockDropZoneConfig} dropZoneConfig configuration data for the drop zone.\n *\n * @return {Object} An object that contains `targetBlockIndex` and the event\n * handlers `onBlockDragOver`, `onBlockDragEnd` and `onBlockDrop`.\n */\nexport default function useBlockDropZone( {\n\t// An undefined value represents a top-level block. Default to an empty\n\t// string for this so that `targetRootClientId` can be easily compared to\n\t// values returned by the `getRootBlockClientId` selector, which also uses\n\t// an empty string to represent top-level blocks.\n\trootClientId: targetRootClientId = '',\n} = {} ) {\n\tconst targetBlockIndex = useSharedValue( null );\n\tconst dragPosition = {\n\t\tx: useSharedValue( 0 ),\n\t\ty: useSharedValue( 0 ),\n\t};\n\tconst prevDragPosition = {\n\t\tx: useSharedValue( 0 ),\n\t\ty: useSharedValue( 0 ),\n\t};\n\n\tconst { getBlockListSettings, getSettings } = useSelect( blockEditorStore );\n\tconst { blocksLayouts, getBlockLayoutsOrderedByYCoord } =\n\t\tuseBlockListContext();\n\n\tconst getSortedBlocksLayouts = useCallback( () => {\n\t\treturn getBlockLayoutsOrderedByYCoord( blocksLayouts.current );\n\t\t// We use the value of `blocksLayouts` as the dependency.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ blocksLayouts.current ] );\n\n\tconst isRTL = getSettings().isRTL;\n\n\tconst onBlockDrop = useOnBlockDrop();\n\n\tconst updateTargetBlockIndex = useCallback(\n\t\t( event ) => {\n\t\t\tconst sortedBlockLayouts = getSortedBlocksLayouts();\n\n\t\t\tconst targetIndex = getNearestBlockIndex(\n\t\t\t\tsortedBlockLayouts,\n\t\t\t\t{ x: event.x, y: event.y },\n\t\t\t\tgetBlockListSettings( targetRootClientId )?.orientation,\n\t\t\t\tisRTL\n\t\t\t);\n\t\t\tif ( targetIndex !== null ) {\n\t\t\t\ttargetBlockIndex.value = targetIndex ?? 0;\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tgetSortedBlocksLayouts,\n\t\t\tgetBlockListSettings,\n\t\t\ttargetRootClientId,\n\t\t\tisRTL,\n\t\t\ttargetBlockIndex,\n\t\t]\n\t);\n\n\tuseDerivedValue( () => {\n\t\tconst x = dragPosition.x.value;\n\t\tconst y = dragPosition.y.value;\n\t\tconst prevX = prevDragPosition.x.value;\n\t\tconst prevY = prevDragPosition.y.value;\n\t\t// `updateTargetBlockIndex` performs expensive calculations, so we throttle\n\t\t// the call using a offset threshold based on the dragging position.\n\t\tif (\n\t\t\tMath.abs( x - prevX ) >= UPDATE_TARGET_BLOCK_INDEX_THRESHOLD ||\n\t\t\tMath.abs( y - prevY ) >= UPDATE_TARGET_BLOCK_INDEX_THRESHOLD\n\t\t) {\n\t\t\trunOnJS( updateTargetBlockIndex )( { x, y } );\n\t\t\tprevDragPosition.x.value = x;\n\t\t\tprevDragPosition.y.value = y;\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t} );\n\n\treturn {\n\t\tonBlockDragOver( { x, y } ) {\n\t\t\tdragPosition.x.value = x;\n\t\t\tdragPosition.y.value = y;\n\t\t},\n\t\tonBlockDragOverWorklet( { x, y } ) {\n\t\t\t'worklet';\n\t\t\tdragPosition.x.value = x;\n\t\t\tdragPosition.y.value = y;\n\t\t},\n\t\tonBlockDragEnd() {\n\t\t\ttargetBlockIndex.value = null;\n\t\t},\n\t\tonBlockDrop: ( event ) => {\n\t\t\tif ( targetBlockIndex.value !== null ) {\n\t\t\t\tonBlockDrop( {\n\t\t\t\t\t...event,\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\ttargetBlockIndex: targetBlockIndex.value,\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\ttargetBlockIndex,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,OAAO,EACPC,eAAe,EACfC,cAAc,QACR,yBAAyB;;AAEhC;AACA;AACA;AACA,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,WAAW,QAAQ,oBAAoB;;AAEhD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,mBAAmB,QAAQ,kCAAkC;AACtE,SAASC,wBAAwB,QAAQ,kBAAkB;AAC3D,OAAOC,cAAc,MAAM,sBAAsB;AAEjD,MAAMC,mCAAmC,GAAG,EAAE,CAAC,CAAC;;AAEhD;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CACnCC,aAAa,EACbC,QAAQ,EACRC,WAAW,EACXC,KAAK,EACJ;EACD,MAAMC,YAAY,GACjBF,WAAW,KAAK,YAAY,GACzB,CAAE,MAAM,EAAE,OAAO,CAAE,GACnB,CAAE,KAAK,EAAE,QAAQ,CAAE;EAEvB,MAAMG,aAAa,GAAGF,KAAK;EAE3B,IAAIG,cAAc;EAClB,IAAIC,iBAAiB;;EAErB;EACAP,aAAa,CAACQ,OAAO,CAAE,CAAEC,OAAO,EAAEC,KAAK,KAAM;IAC5C,MAAM;MAAEC,CAAC;MAAEC,CAAC;MAAEC,KAAK;MAAEC;IAAO,CAAC,GAAGL,OAAO;IACvC,MAAMM,IAAI,GAAG;MACZJ,CAAC,EAAEF,OAAO,CAACE,CAAC;MACZC,CAAC,EAAEH,OAAO,CAACG,CAAC;MACZI,GAAG,EAAEJ,CAAC;MACNK,KAAK,EAAEN,CAAC,GAAGE,KAAK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AAI5C,mCAAmC,IAC5D8C,IAAI,CAACC,GAAG,CAAEjC,CAAC,GAAG+B,KAAM,CAAC,IAAI7C,mCAAmC,EAC3D;MACDV,OAAO,CAAEiD,sBAAuB,CAAC,CAAE;QAAE1B,CAAC;QAAEC;MAAE,CAAE,CAAC;MAC7CkB,gBAAgB,CAACnB,CAAC,CAAC8B,KAAK,GAAG9B,CAAC;MAC5BmB,gBAAgB,CAAClB,CAAC,CAAC6B,KAAK,GAAG7B,CAAC;MAC5B,OAAO,IAAI;IACZ;IACA,OAAO,KAAK;EACb,CAAE,CAAC;EAEH,OAAO;IACNkC,eAAeA,CAAE;MAAEnC,CAAC;MAAEC;IAAE,CAAC,EAAG;MAC3BiB,YAAY,CAAClB,CAAC,CAAC8B,KAAK,GAAG9B,CAAC;MACxBkB,YAAY,CAACjB,CAAC,CAAC6B,KAAK,GAAG7B,CAAC;IACzB,CAAC;IACDmC,sBAAsBA,CAAE;MAAEpC,CAAC;MAAEC;IAAE,CAAC,EAAG;MAClC,SAAS;;MACTiB,YAAY,CAAClB,CAAC,CAAC8B,KAAK,GAAG9B,CAAC;MACxBkB,YAAY,CAACjB,CAAC,CAAC6B,KAAK,GAAG7B,CAAC;IACzB,CAAC;IACDoC,cAAcA,CAAA,EAAG;MAChBpB,gBAAgB,CAACa,KAAK,GAAG,IAAI;IAC9B,CAAC;IACDL,WAAW,EAAIE,KAAK,IAAM;MACzB,IAAKV,gBAAgB,CAACa,KAAK,KAAK,IAAI,EAAG;QACtCL,WAAW,CAAE;UACZ,GAAGE,KAAK;UACRX,kBAAkB;UAClBC,gBAAgB,EAAEA,gBAAgB,CAACa;QACpC,CAAE,CAAC;MACJ;IACD,CAAC;IACDb;EACD,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["runOnJS","useDerivedValue","useSharedValue","useSelect","useCallback","store","blockEditorStore","useBlockListContext","getDistanceToNearestEdge","useOnBlockDrop","UPDATE_TARGET_BLOCK_INDEX_THRESHOLD","getNearestBlockIndex","blocksLayouts","position","orientation","isRTL","allowedEdges","isRightToLeft","candidateIndex","candidateDistance","forEach","element","index","x","y","width","height","rect","top","right","bottom","left","distance","edge","undefined","isTrailingEdge","offset","useBlockDropZone","rootClientId","targetRootClientId","targetBlockIndex","dragPosition","prevDragPosition","getBlockListSettings","getSettings","getBlockLayoutsOrderedByYCoord","getSortedBlocksLayouts","current","onBlockDrop","updateTargetBlockIndex","event","sortedBlockLayouts","targetIndex","value","prevX","prevY","Math","abs","onBlockDragOver","onBlockDragOverWorklet","onBlockDragEnd"],"sources":["@wordpress/block-editor/src/components/use-block-drop-zone/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport {\n\trunOnJS,\n\tuseDerivedValue,\n\tuseSharedValue,\n} from 'react-native-reanimated';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useBlockListContext } from '../block-list/block-list-context';\nimport { getDistanceToNearestEdge } from '../../utils/math';\nimport useOnBlockDrop from '../use-on-block-drop';\n\nconst UPDATE_TARGET_BLOCK_INDEX_THRESHOLD = 20; // In pixels\n\n/** @typedef {import('../../utils/math').WPPoint} WPPoint */\n\n/**\n * The orientation of a block list.\n *\n * @typedef {'horizontal'|'vertical'|undefined} WPBlockListOrientation\n */\n\n/**\n * Given a list of blocks layouts finds the index that a block should be dropped at.\n *\n * @param {Object} blocksLayouts Blocks layouts object.\n * @param {WPPoint} position The position of the item being dragged.\n * @param {WPBlockListOrientation} orientation The orientation of a block list.\n * @param {boolean} isRTL Check if current locale is RTL.\n *\n * @return {number|undefined} The block index that's closest to the drag position.\n */\nexport function getNearestBlockIndex(\n\tblocksLayouts,\n\tposition,\n\torientation,\n\tisRTL\n) {\n\tconst allowedEdges =\n\t\torientation === 'horizontal'\n\t\t\t? [ 'left', 'right' ]\n\t\t\t: [ 'top', 'bottom' ];\n\n\tconst isRightToLeft = isRTL;\n\n\tlet candidateIndex;\n\tlet candidateDistance;\n\n\t// Only enabled for root level blocks.\n\tblocksLayouts.forEach( ( element, index ) => {\n\t\tconst { x, y, width, height } = element;\n\t\tconst rect = {\n\t\t\tx: element.x,\n\t\t\ty: element.y,\n\t\t\ttop: y,\n\t\t\tright: x + width,\n\t\t\tbottom: y + height,\n\t\t\tleft: x,\n\t\t\twidth,\n\t\t\theight,\n\t\t};\n\t\tconst [ distance, edge ] = getDistanceToNearestEdge(\n\t\t\tposition,\n\t\t\trect,\n\t\t\tallowedEdges\n\t\t);\n\n\t\tif ( candidateDistance === undefined || distance < candidateDistance ) {\n\t\t\t// If the user is dropping to the trailing edge of the block\n\t\t\t// add 1 to the index to represent dragging after.\n\t\t\t// Take RTL languages into account where the left edge is\n\t\t\t// the trailing edge.\n\t\t\tconst isTrailingEdge =\n\t\t\t\tedge === 'bottom' ||\n\t\t\t\t( ! isRightToLeft && edge === 'right' ) ||\n\t\t\t\t( isRightToLeft && edge === 'left' );\n\t\t\tconst offset = isTrailingEdge ? 1 : 0;\n\n\t\t\t// Update the currently known best candidate.\n\t\t\tcandidateDistance = distance;\n\t\t\tcandidateIndex = index + offset;\n\t\t}\n\t} );\n\treturn candidateIndex;\n}\n\n/**\n * @typedef {Object} WPBlockDropZoneConfig\n * @property {string} rootClientId The root client id for the block list.\n */\n\n/**\n * A React hook that can be used to make a block list handle drag and drop.\n *\n * @param {WPBlockDropZoneConfig} dropZoneConfig configuration data for the drop zone.\n *\n * @return {Object} An object that contains `targetBlockIndex` and the event\n * handlers `onBlockDragOver`, `onBlockDragEnd` and `onBlockDrop`.\n */\nexport default function useBlockDropZone( {\n\t// An undefined value represents a top-level block. Default to an empty\n\t// string for this so that `targetRootClientId` can be easily compared to\n\t// values returned by the `getRootBlockClientId` selector, which also uses\n\t// an empty string to represent top-level blocks.\n\trootClientId: targetRootClientId = '',\n} = {} ) {\n\tconst targetBlockIndex = useSharedValue( null );\n\tconst dragPosition = {\n\t\tx: useSharedValue( 0 ),\n\t\ty: useSharedValue( 0 ),\n\t};\n\tconst prevDragPosition = {\n\t\tx: useSharedValue( 0 ),\n\t\ty: useSharedValue( 0 ),\n\t};\n\n\tconst { getBlockListSettings, getSettings } = useSelect( blockEditorStore );\n\tconst { blocksLayouts, getBlockLayoutsOrderedByYCoord } =\n\t\tuseBlockListContext();\n\n\tconst getSortedBlocksLayouts = useCallback( () => {\n\t\treturn getBlockLayoutsOrderedByYCoord( blocksLayouts.current );\n\t\t// We use the value of `blocksLayouts` as the dependency.\n\t}, [ blocksLayouts.current ] );\n\n\tconst isRTL = getSettings().isRTL;\n\n\tconst onBlockDrop = useOnBlockDrop();\n\n\tconst updateTargetBlockIndex = useCallback(\n\t\t( event ) => {\n\t\t\tconst sortedBlockLayouts = getSortedBlocksLayouts();\n\n\t\t\tconst targetIndex = getNearestBlockIndex(\n\t\t\t\tsortedBlockLayouts,\n\t\t\t\t{ x: event.x, y: event.y },\n\t\t\t\tgetBlockListSettings( targetRootClientId )?.orientation,\n\t\t\t\tisRTL\n\t\t\t);\n\t\t\tif ( targetIndex !== null ) {\n\t\t\t\ttargetBlockIndex.value = targetIndex ?? 0;\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tgetSortedBlocksLayouts,\n\t\t\tgetBlockListSettings,\n\t\t\ttargetRootClientId,\n\t\t\tisRTL,\n\t\t\ttargetBlockIndex,\n\t\t]\n\t);\n\n\tuseDerivedValue( () => {\n\t\tconst x = dragPosition.x.value;\n\t\tconst y = dragPosition.y.value;\n\t\tconst prevX = prevDragPosition.x.value;\n\t\tconst prevY = prevDragPosition.y.value;\n\t\t// `updateTargetBlockIndex` performs expensive calculations, so we throttle\n\t\t// the call using a offset threshold based on the dragging position.\n\t\tif (\n\t\t\tMath.abs( x - prevX ) >= UPDATE_TARGET_BLOCK_INDEX_THRESHOLD ||\n\t\t\tMath.abs( y - prevY ) >= UPDATE_TARGET_BLOCK_INDEX_THRESHOLD\n\t\t) {\n\t\t\trunOnJS( updateTargetBlockIndex )( { x, y } );\n\t\t\tprevDragPosition.x.value = x;\n\t\t\tprevDragPosition.y.value = y;\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t} );\n\n\treturn {\n\t\tonBlockDragOver( { x, y } ) {\n\t\t\tdragPosition.x.value = x;\n\t\t\tdragPosition.y.value = y;\n\t\t},\n\t\tonBlockDragOverWorklet( { x, y } ) {\n\t\t\t'worklet';\n\t\t\tdragPosition.x.value = x;\n\t\t\tdragPosition.y.value = y;\n\t\t},\n\t\tonBlockDragEnd() {\n\t\t\ttargetBlockIndex.value = null;\n\t\t},\n\t\tonBlockDrop: ( event ) => {\n\t\t\tif ( targetBlockIndex.value !== null ) {\n\t\t\t\tonBlockDrop( {\n\t\t\t\t\t...event,\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\ttargetBlockIndex: targetBlockIndex.value,\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\ttargetBlockIndex,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,OAAO,EACPC,eAAe,EACfC,cAAc,QACR,yBAAyB;;AAEhC;AACA;AACA;AACA,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,WAAW,QAAQ,oBAAoB;;AAEhD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,mBAAmB,QAAQ,kCAAkC;AACtE,SAASC,wBAAwB,QAAQ,kBAAkB;AAC3D,OAAOC,cAAc,MAAM,sBAAsB;AAEjD,MAAMC,mCAAmC,GAAG,EAAE,CAAC,CAAC;;AAEhD;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CACnCC,aAAa,EACbC,QAAQ,EACRC,WAAW,EACXC,KAAK,EACJ;EACD,MAAMC,YAAY,GACjBF,WAAW,KAAK,YAAY,GACzB,CAAE,MAAM,EAAE,OAAO,CAAE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B,CAACa,KAAK,GAAG,IAAI;IAC9B,CAAC;IACDL,WAAW,EAAIE,KAAK,IAAM;MACzB,IAAKV,gBAAgB,CAACa,KAAK,KAAK,IAAI,EAAG;QACtCL,WAAW,CAAE;UACZ,GAAGE,KAAK;UACRX,kBAAkB;UAClBC,gBAAgB,EAAEA,gBAAgB,CAACa;QACpC,CAAE,CAAC;MACJ;IACD,CAAC;IACDb;EACD,CAAC;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["useRefEffect","useSelect","store","blockEditorStore","unlock","useFlashEditableBlocks","clientId","isEnabled","getEnabledClientIdsTree","element","flashEditableBlocks","forEach","id","block","querySelector","classList","remove","offsetWidth","add","handleClick","event","shouldFlash","target","contains","defaultPrevented","preventDefault","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/use-flash-editable-blocks/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport function useFlashEditableBlocks( {\n\tclientId = '',\n\tisEnabled = true,\n} = {} ) {\n\tconst { getEnabledClientIdsTree } = unlock( useSelect( blockEditorStore ) );\n\n\treturn useRefEffect(\n\t\t( element ) => {\n\t\t\tif ( ! isEnabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst flashEditableBlocks = () => {\n\t\t\t\tgetEnabledClientIdsTree( clientId ).forEach(\n\t\t\t\t\t( { clientId: id } ) => {\n\t\t\t\t\t\tconst block = element.querySelector(\n\t\t\t\t\t\t\t`[data-block=\"${ id }\"]`\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( ! block ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tblock.classList.remove( 'has-editable-outline' );\n\t\t\t\t\t\t// Force reflow to trigger the animation.\n\t\t\t\t\t\t// eslint-disable-next-line no-unused-expressions\n\t\t\t\t\t\tblock.offsetWidth;\n\t\t\t\t\t\tblock.classList.add( 'has-editable-outline' );\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t};\n\n\t\t\tconst handleClick = ( event ) => {\n\t\t\t\tconst shouldFlash =\n\t\t\t\t\tevent.target === element ||\n\t\t\t\t\tevent.target.classList.contains( 'is-root-container' );\n\t\t\t\tif ( ! shouldFlash ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tevent.preventDefault();\n\t\t\t\tflashEditableBlocks();\n\t\t\t};\n\n\t\t\telement.addEventListener( 'click', handleClick );\n\t\t\treturn () => element.removeEventListener( 'click', handleClick );\n\t\t},\n\t\t[ isEnabled ]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,oBAAoB;AACjD,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,OAAO,SAASC,sBAAsBA,CAAE;EACvCC,QAAQ,GAAG,EAAE;EACbC,SAAS,GAAG;AACb,CAAC,GAAG,CAAC,CAAC,EAAG;EACR,MAAM;IAAEC;EAAwB,CAAC,GAAGJ,MAAM,CAAEH,SAAS,CAAEE,gBAAiB,CAAE,CAAC;EAE3E,OAAOH,YAAY,CAChBS,OAAO,IAAM;IACd,IAAK,CAAEF,SAAS,EAAG;MAClB;IACD;IAEA,MAAMG,mBAAmB,GAAGA,CAAA,KAAM;MACjCF,uBAAuB,CAAEF,QAAS,CAAC,CAACK,OAAO,CAC1C,CAAE;QAAEL,QAAQ,EAAEM;MAAG,CAAC,KAAM;QACvB,MAAMC,KAAK,GAAGJ,OAAO,CAACK,aAAa,CACjC,gBAAgBF,EAAI,IACtB,CAAC;QACD,IAAK,CAAEC,KAAK,EAAG;UACd;QACD;QACAA,KAAK,CAACE,SAAS,CAACC,MAAM,CAAE,sBAAuB,CAAC;QAChD;QACA;QACAH,KAAK,CAACI,WAAW;QACjBJ,KAAK,CAACE,SAAS,CAACG,GAAG,CAAE,sBAAuB,CAAC;MAC9C,CACD,CAAC;IACF,CAAC;IAED,MAAMC,WAAW,GAAKC,KAAK,IAAM;MAChC,MAAMC,WAAW,GAChBD,KAAK,CAACE,MAAM,KAAKb,OAAO,IACxBW,KAAK,CAACE,MAAM,CAACP,SAAS,CAACQ,QAAQ,CAAE,mBAAoB,CAAC;MACvD,IAAK,CAAEF,WAAW,EAAG;QACpB;MACD;MACA,IAAKD,KAAK,CAACI,gBAAgB,EAAG;QAC7B;MACD;MACAJ,KAAK,CAACK,cAAc,CAAC,CAAC;MACtBf,mBAAmB,CAAC,CAAC;IACtB,CAAC;IAEDD,OAAO,CAACiB,gBAAgB,CAAE,OAAO,EAAEP,WAAY,CAAC;IAChD,OAAO,MAAMV,OAAO,CAACkB,mBAAmB,CAAE,OAAO,EAAER,WAAY,CAAC;EACjE,CAAC,EACD,CAAEZ,SAAS,CACZ,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["useRefEffect","useSelect","store","blockEditorStore","unlock","useFlashEditableBlocks","clientId","isEnabled","getEnabledClientIdsTree","element","flashEditableBlocks","forEach","id","block","querySelector","classList","remove","offsetWidth","add","handleClick","event","shouldFlash","target","contains","defaultPrevented","preventDefault","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/use-flash-editable-blocks/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport function useFlashEditableBlocks( {\n\tclientId = '',\n\tisEnabled = true,\n} = {} ) {\n\tconst { getEnabledClientIdsTree } = unlock( useSelect( blockEditorStore ) );\n\n\treturn useRefEffect(\n\t\t( element ) => {\n\t\t\tif ( ! isEnabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst flashEditableBlocks = () => {\n\t\t\t\tgetEnabledClientIdsTree( clientId ).forEach(\n\t\t\t\t\t( { clientId: id } ) => {\n\t\t\t\t\t\tconst block = element.querySelector(\n\t\t\t\t\t\t\t`[data-block=\"${ id }\"]`\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( ! block ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tblock.classList.remove( 'has-editable-outline' );\n\t\t\t\t\t\t// Force reflow to trigger the animation.\n\t\t\t\t\t\t// eslint-disable-next-line no-unused-expressions\n\t\t\t\t\t\tblock.offsetWidth;\n\t\t\t\t\t\tblock.classList.add( 'has-editable-outline' );\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t};\n\n\t\t\tconst handleClick = ( event ) => {\n\t\t\t\tconst shouldFlash =\n\t\t\t\t\tevent.target === element ||\n\t\t\t\t\tevent.target.classList.contains( 'is-root-container' );\n\t\t\t\tif ( ! shouldFlash ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tevent.preventDefault();\n\t\t\t\tflashEditableBlocks();\n\t\t\t};\n\n\t\t\telement.addEventListener( 'click', handleClick );\n\t\t\treturn () => element.removeEventListener( 'click', handleClick );\n\t\t},\n\t\t[ isEnabled ]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,oBAAoB;AACjD,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,OAAO,SAASC,sBAAsBA,CAAE;EACvCC,QAAQ,GAAG,EAAE;EACbC,SAAS,GAAG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: ref.current && getAbsolutePosition(ref.current),
66
66
  prevRect: ref.current && ref.current.getBoundingClientRect()
67
- }),
68
- // eslint-disable-next-line react-hooks/exhaustive-deps
69
- [triggerAnimationOnChange]);
67
+ }), [triggerAnimationOnChange]);
70
68
  useLayoutEffect(() => {
71
69
  if (!previous || !ref.current) {
72
70
  return;
@@ -1 +1 @@
1
- {"version":3,"names":["Controller","useLayoutEffect","useMemo","useRef","getScrollContainer","useSelect","store","blockEditorStore","BLOCK_ANIMATION_THRESHOLD","getAbsolutePosition","element","top","offsetTop","left","offsetLeft","useMovingAnimation","triggerAnimationOnChange","clientId","ref","isTyping","getGlobalBlockCount","isBlockSelected","isFirstMultiSelectedBlock","isBlockMultiSelected","isAncestorMultiSelected","previous","prevRect","current","getBoundingClientRect","scrollContainer","isSelected","adjustScrolling","preserveScrollPosition","blockRect","diff","scrollTop","disableAnimation","window","matchMedia","matches","isPartOfSelection","zIndex","controller","x","y","config","mass","tension","friction","onChange","value","Math","round","finishedMoving","style","transformOrigin","transform","undefined","destination","start","from","stop","set"],"sources":["@wordpress/block-editor/src/components/use-moving-animation/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Controller } from '@react-spring/web';\n\n/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useMemo, useRef } from '@wordpress/element';\nimport { getScrollContainer } from '@wordpress/dom';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * If the block count exceeds the threshold, we disable the reordering animation\n * to avoid laginess.\n */\nconst BLOCK_ANIMATION_THRESHOLD = 200;\n\nfunction getAbsolutePosition( element ) {\n\treturn {\n\t\ttop: element.offsetTop,\n\t\tleft: element.offsetLeft,\n\t};\n}\n\n/**\n * Hook used to compute the styles required to move a div into a new position.\n *\n * The way this animation works is the following:\n * - It first renders the element as if there was no animation.\n * - It takes a snapshot of the position of the block to use it\n * as a destination point for the animation.\n * - It restores the element to the previous position using a CSS transform\n * - It uses the \"resetAnimation\" flag to reset the animation\n * from the beginning in order to animate to the new destination point.\n *\n * @param {Object} $1 Options\n * @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes.\n * @param {string} $1.clientId\n */\nfunction useMovingAnimation( { triggerAnimationOnChange, clientId } ) {\n\tconst ref = useRef();\n\tconst {\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t} = useSelect( blockEditorStore );\n\n\t// Whenever the trigger changes, we need to take a snapshot of the current\n\t// position of the block to use it as a destination point for the animation.\n\tconst { previous, prevRect } = useMemo(\n\t\t() => ( {\n\t\t\tprevious: ref.current && getAbsolutePosition( ref.current ),\n\t\t\tprevRect: ref.current && ref.current.getBoundingClientRect(),\n\t\t} ),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[ triggerAnimationOnChange ]\n\t);\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! previous || ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst scrollContainer = getScrollContainer( ref.current );\n\t\tconst isSelected = isBlockSelected( clientId );\n\t\tconst adjustScrolling =\n\t\t\tisSelected || isFirstMultiSelectedBlock( clientId );\n\n\t\tfunction preserveScrollPosition() {\n\t\t\tif ( adjustScrolling && prevRect ) {\n\t\t\t\tconst blockRect = ref.current.getBoundingClientRect();\n\t\t\t\tconst diff = blockRect.top - prevRect.top;\n\n\t\t\t\tif ( diff ) {\n\t\t\t\t\tscrollContainer.scrollTop += diff;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// We disable the animation if the user has a preference for reduced\n\t\t// motion, if the user is typing (insertion by Enter), or if the block\n\t\t// count exceeds the threshold (insertion caused all the blocks that\n\t\t// follow to animate).\n\t\t// To do: consider enableing the _moving_ animation even for large\n\t\t// posts, while only disabling the _insertion_ animation?\n\t\tconst disableAnimation =\n\t\t\twindow.matchMedia( '(prefers-reduced-motion: reduce)' ).matches ||\n\t\t\tisTyping() ||\n\t\t\tgetGlobalBlockCount() > BLOCK_ANIMATION_THRESHOLD;\n\n\t\tif ( disableAnimation ) {\n\t\t\t// If the animation is disabled and the scroll needs to be adjusted,\n\t\t\t// just move directly to the final scroll position.\n\t\t\tpreserveScrollPosition();\n\t\t\treturn;\n\t\t}\n\n\t\tconst isPartOfSelection =\n\t\t\tisSelected ||\n\t\t\tisBlockMultiSelected( clientId ) ||\n\t\t\tisAncestorMultiSelected( clientId );\n\t\t// Make sure the other blocks move under the selected block(s).\n\t\tconst zIndex = isPartOfSelection ? '1' : '';\n\n\t\tconst controller = new Controller( {\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\tconfig: { mass: 5, tension: 2000, friction: 200 },\n\t\t\tonChange( { value } ) {\n\t\t\t\tif ( ! ref.current ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlet { x, y } = value;\n\t\t\t\tx = Math.round( x );\n\t\t\t\ty = Math.round( y );\n\t\t\t\tconst finishedMoving = x === 0 && y === 0;\n\t\t\t\tref.current.style.transformOrigin = 'center center';\n\t\t\t\tref.current.style.transform = finishedMoving\n\t\t\t\t\t? null // Set to `null` to explicitly remove the transform.\n\t\t\t\t\t: `translate3d(${ x }px,${ y }px,0)`;\n\t\t\t\tref.current.style.zIndex = zIndex;\n\t\t\t\tpreserveScrollPosition();\n\t\t\t},\n\t\t} );\n\n\t\tref.current.style.transform = undefined;\n\t\tconst destination = getAbsolutePosition( ref.current );\n\n\t\tconst x = Math.round( previous.left - destination.left );\n\t\tconst y = Math.round( previous.top - destination.top );\n\n\t\tcontroller.start( { x: 0, y: 0, from: { x, y } } );\n\n\t\treturn () => {\n\t\t\tcontroller.stop();\n\t\t\tcontroller.set( { x: 0, y: 0 } );\n\t\t};\n\t}, [\n\t\tprevious,\n\t\tprevRect,\n\t\tclientId,\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t] );\n\n\treturn ref;\n}\n\nexport default useMovingAnimation;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,mBAAmB;;AAE9C;AACA;AACA;AACA,SAASC,eAAe,EAAEC,OAAO,EAAEC,MAAM,QAAQ,oBAAoB;AACrE,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA;AACA,MAAMC,yBAAyB,GAAG,GAAG;AAErC,SAASC,mBAAmBA,CAAEC,OAAO,EAAG;EACvC,OAAO;IACNC,GAAG,EAAED,OAAO,CAACE,SAAS;IACtBC,IAAI,EAAEH,OAAO,CAACI;EACf,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,kBAAkBA,CAAE;EAAEC,wBAAwB;EAAEC;AAAS,CAAC,EAAG;EACrE,MAAMC,GAAG,GAAGf,MAAM,CAAC,CAAC;EACpB,MAAM;IACLgB,QAAQ;IACRC,mBAAmB;IACnBC,eAAe;IACfC,yBAAyB;IACzBC,oBAAoB;IACpBC;EACD,CAAC,GAAGnB,SAAS,CAAEE,gBAAiB,CAAC;;EAEjC;EACA;EACA,MAAM;IAAEkB,QAAQ;IAAEC;EAAS,CAAC,GAAGxB,OAAO,CACrC,OAAQ;IACPuB,QAAQ,EAAEP,GAAG,CAACS,OAAO,IAAIlB,mBAAmB,CAAES,GAAG,CAACS,OAAQ,CAAC;IAC3DD,QAAQ,EAAER,GAAG,CAACS,OAAO,IAAIT,GAAG,CAACS,OAAO,CAACC,qBAAqB,CAAC;EAC5D,CAAC,CAAE;EACH;EACA,CAAEZ,wBAAwB,CAC3B,CAAC;EAEDf,eAAe,CA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,CAAC;QAAEC,CAAC,EAAE;MAAE,CAAE,CAAC;IACjC,CAAC;EACF,CAAC,EAAE,CACFnB,QAAQ,EACRC,QAAQ,EACRT,QAAQ,EACRE,QAAQ,EACRC,mBAAmB,EACnBC,eAAe,EACfC,yBAAyB,EACzBC,oBAAoB,EACpBC,uBAAuB,CACtB,CAAC;EAEH,OAAON,GAAG;AACX;AAEA,eAAeH,kBAAkB","ignoreList":[]}
1
+ {"version":3,"names":["Controller","useLayoutEffect","useMemo","useRef","getScrollContainer","useSelect","store","blockEditorStore","BLOCK_ANIMATION_THRESHOLD","getAbsolutePosition","element","top","offsetTop","left","offsetLeft","useMovingAnimation","triggerAnimationOnChange","clientId","ref","isTyping","getGlobalBlockCount","isBlockSelected","isFirstMultiSelectedBlock","isBlockMultiSelected","isAncestorMultiSelected","previous","prevRect","current","getBoundingClientRect","scrollContainer","isSelected","adjustScrolling","preserveScrollPosition","blockRect","diff","scrollTop","disableAnimation","window","matchMedia","matches","isPartOfSelection","zIndex","controller","x","y","config","mass","tension","friction","onChange","value","Math","round","finishedMoving","style","transformOrigin","transform","undefined","destination","start","from","stop","set"],"sources":["@wordpress/block-editor/src/components/use-moving-animation/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Controller } from '@react-spring/web';\n\n/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useMemo, useRef } from '@wordpress/element';\nimport { getScrollContainer } from '@wordpress/dom';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * If the block count exceeds the threshold, we disable the reordering animation\n * to avoid laginess.\n */\nconst BLOCK_ANIMATION_THRESHOLD = 200;\n\nfunction getAbsolutePosition( element ) {\n\treturn {\n\t\ttop: element.offsetTop,\n\t\tleft: element.offsetLeft,\n\t};\n}\n\n/**\n * Hook used to compute the styles required to move a div into a new position.\n *\n * The way this animation works is the following:\n * - It first renders the element as if there was no animation.\n * - It takes a snapshot of the position of the block to use it\n * as a destination point for the animation.\n * - It restores the element to the previous position using a CSS transform\n * - It uses the \"resetAnimation\" flag to reset the animation\n * from the beginning in order to animate to the new destination point.\n *\n * @param {Object} $1 Options\n * @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes.\n * @param {string} $1.clientId\n */\nfunction useMovingAnimation( { triggerAnimationOnChange, clientId } ) {\n\tconst ref = useRef();\n\tconst {\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t} = useSelect( blockEditorStore );\n\n\t// Whenever the trigger changes, we need to take a snapshot of the current\n\t// position of the block to use it as a destination point for the animation.\n\tconst { previous, prevRect } = useMemo(\n\t\t() => ( {\n\t\t\tprevious: ref.current && getAbsolutePosition( ref.current ),\n\t\t\tprevRect: ref.current && ref.current.getBoundingClientRect(),\n\t\t} ),\n\t\t[ triggerAnimationOnChange ]\n\t);\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! previous || ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst scrollContainer = getScrollContainer( ref.current );\n\t\tconst isSelected = isBlockSelected( clientId );\n\t\tconst adjustScrolling =\n\t\t\tisSelected || isFirstMultiSelectedBlock( clientId );\n\n\t\tfunction preserveScrollPosition() {\n\t\t\tif ( adjustScrolling && prevRect ) {\n\t\t\t\tconst blockRect = ref.current.getBoundingClientRect();\n\t\t\t\tconst diff = blockRect.top - prevRect.top;\n\n\t\t\t\tif ( diff ) {\n\t\t\t\t\tscrollContainer.scrollTop += diff;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// We disable the animation if the user has a preference for reduced\n\t\t// motion, if the user is typing (insertion by Enter), or if the block\n\t\t// count exceeds the threshold (insertion caused all the blocks that\n\t\t// follow to animate).\n\t\t// To do: consider enableing the _moving_ animation even for large\n\t\t// posts, while only disabling the _insertion_ animation?\n\t\tconst disableAnimation =\n\t\t\twindow.matchMedia( '(prefers-reduced-motion: reduce)' ).matches ||\n\t\t\tisTyping() ||\n\t\t\tgetGlobalBlockCount() > BLOCK_ANIMATION_THRESHOLD;\n\n\t\tif ( disableAnimation ) {\n\t\t\t// If the animation is disabled and the scroll needs to be adjusted,\n\t\t\t// just move directly to the final scroll position.\n\t\t\tpreserveScrollPosition();\n\t\t\treturn;\n\t\t}\n\n\t\tconst isPartOfSelection =\n\t\t\tisSelected ||\n\t\t\tisBlockMultiSelected( clientId ) ||\n\t\t\tisAncestorMultiSelected( clientId );\n\t\t// Make sure the other blocks move under the selected block(s).\n\t\tconst zIndex = isPartOfSelection ? '1' : '';\n\n\t\tconst controller = new Controller( {\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\tconfig: { mass: 5, tension: 2000, friction: 200 },\n\t\t\tonChange( { value } ) {\n\t\t\t\tif ( ! ref.current ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlet { x, y } = value;\n\t\t\t\tx = Math.round( x );\n\t\t\t\ty = Math.round( y );\n\t\t\t\tconst finishedMoving = x === 0 && y === 0;\n\t\t\t\tref.current.style.transformOrigin = 'center center';\n\t\t\t\tref.current.style.transform = finishedMoving\n\t\t\t\t\t? null // Set to `null` to explicitly remove the transform.\n\t\t\t\t\t: `translate3d(${ x }px,${ y }px,0)`;\n\t\t\t\tref.current.style.zIndex = zIndex;\n\t\t\t\tpreserveScrollPosition();\n\t\t\t},\n\t\t} );\n\n\t\tref.current.style.transform = undefined;\n\t\tconst destination = getAbsolutePosition( ref.current );\n\n\t\tconst x = Math.round( previous.left - destination.left );\n\t\tconst y = Math.round( previous.top - destination.top );\n\n\t\tcontroller.start( { x: 0, y: 0, from: { x, y } } );\n\n\t\treturn () => {\n\t\t\tcontroller.stop();\n\t\t\tcontroller.set( { x: 0, y: 0 } );\n\t\t};\n\t}, [\n\t\tprevious,\n\t\tprevRect,\n\t\tclientId,\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t] );\n\n\treturn ref;\n}\n\nexport default useMovingAnimation;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,mBAAmB;;AAE9C;AACA;AACA;AACA,SAASC,eAAe,EAAEC,OAAO,EAAEC,MAAM,QAAQ,oBAAoB;AACrE,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA;AACA,MAAMC,yBAAyB,GAAG,GAAG;AAErC,SAASC,mBAAmBA,CAAEC,OAAO,EAAG;EACvC,OAAO;IACNC,GAAG,EAAED,OAAO,CAACE,SAAS;IACtBC,IAAI,EAAEH,OAAO,CAACI;EACf,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,kBAAkBA,CAAE;EAAEC,wBAAwB;EAAEC;AAAS,CAAC,EAAG;EACrE,MAAMC,GAAG,GAAGf,MAAM,CAAC,CAAC;EACpB,MAAM;IACLgB,QAAQ;IACRC,mBAAmB;IACnBC,eAAe;IACfC,yBAAyB;IACzBC,oBAAoB;IACpBC;EACD,CAAC,GAAGnB,SAAS,CAAEE,gBAAiB,CAAC;;EAEjC;EACA;EACA,MAAM;IAAEkB,QAAQ;IAAEC;EAAS,CAAC,GAAGxB,OAAO,CACrC,OAAQ;IACPuB,QAAQ,EAAEP,GAAG,CAACS,OAAO,IAAIlB,mBAAmB,CAAES,GAAG,CAACS,OAAQ,CAAC;IAC3DD,QAAQ,EAAER,GAAG,CAACS,OAAO,IAAIT,GAAG,CAACS,OAAO,CAACC,qBAAqB,CAAC;EAC5D,CAAC,CAAE,EACH,CAAEZ,wBAAwB,CAC3B,CAAC;EAEDf,e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AC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAE,CAAE,CAAC;IACjC,CAAC;EACF,CAAC,EAAE,CACFnB,QAAQ,EACRC,QAAQ,EACRT,QAAQ,EACRE,QAAQ,EACRC,mBAAmB,EACnBC,eAAe,EACfC,yBAAyB,EACzBC,oBAAoB,EACpBC,uBAAuB,CACtB,CAAC;EAEH,OAAON,GAAG;AACX;AAEA,eAAeH,kBAAkB","ignoreList":[]}
@@ -36,10 +36,9 @@ export default function useResizeCanvas(deviceType) {
36
36
  }
37
37
  return deviceWidth < actualWidth ? deviceWidth : actualWidth;
38
38
  };
39
- const marginValue = () => window.innerHeight < 800 ? 36 : 64;
40
39
  const contentInlineStyles = device => {
41
40
  const height = device === 'Mobile' ? '768px' : '1024px';
42
- const marginVertical = marginValue() + 'px';
41
+ const marginVertical = '40px';
43
42
  const marginHorizontal = 'auto';
44
43
  switch (device) {
45
44
  case 'Tablet':
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useState","useResizeCanvas","deviceType","actualWidth","updateActualWidth","window","innerWidth","resizeListener","addEventListener","removeEventListener","getCanvasWidth","device","deviceWidth","marginValue","innerHeight","contentInlineStyles","height","marginVertical","marginHorizontal","width","marginTop","marginBottom","marginLeft","marginRight","overflowY"],"sources":["@wordpress/block-editor/src/components/use-resize-canvas/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\n\n/**\n * Function to resize the editor window.\n *\n * @param {string} deviceType Used for determining the size of the container (e.g. Desktop, Tablet, Mobile)\n *\n * @return {Object} Inline styles to be added to resizable container.\n */\nexport default function useResizeCanvas( deviceType ) {\n\tconst [ actualWidth, updateActualWidth ] = useState( window.innerWidth );\n\n\tuseEffect( () => {\n\t\tif ( deviceType === 'Desktop' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst resizeListener = () => updateActualWidth( window.innerWidth );\n\t\twindow.addEventListener( 'resize', resizeListener );\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener( 'resize', resizeListener );\n\t\t};\n\t}, [ deviceType ] );\n\n\tconst getCanvasWidth = ( device ) => {\n\t\tlet deviceWidth;\n\n\t\tswitch ( device ) {\n\t\t\tcase 'Tablet':\n\t\t\t\tdeviceWidth = 780;\n\t\t\t\tbreak;\n\t\t\tcase 'Mobile':\n\t\t\t\tdeviceWidth = 360;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn null;\n\t\t}\n\n\t\treturn deviceWidth < actualWidth ? deviceWidth : actualWidth;\n\t};\n\n\tconst marginValue = () => ( window.innerHeight < 800 ? 36 : 64 );\n\n\tconst contentInlineStyles = ( device ) => {\n\t\tconst height = device === 'Mobile' ? '768px' : '1024px';\n\t\tconst marginVertical = marginValue() + 'px';\n\t\tconst marginHorizontal = 'auto';\n\n\t\tswitch ( device ) {\n\t\t\tcase 'Tablet':\n\t\t\tcase 'Mobile':\n\t\t\t\treturn {\n\t\t\t\t\twidth: getCanvasWidth( device ),\n\t\t\t\t\t// Keeping margin styles separate to avoid warnings\n\t\t\t\t\t// when those props get overridden in the iframe component\n\t\t\t\t\tmarginTop: marginVertical,\n\t\t\t\t\tmarginBottom: marginVertical,\n\t\t\t\t\tmarginLeft: marginHorizontal,\n\t\t\t\t\tmarginRight: marginHorizontal,\n\t\t\t\t\theight,\n\t\t\t\t\toverflowY: 'auto',\n\t\t\t\t};\n\t\t\tdefault:\n\t\t\t\treturn {\n\t\t\t\t\tmarginLeft: marginHorizontal,\n\t\t\t\t\tmarginRight: marginHorizontal,\n\t\t\t\t};\n\t\t}\n\t};\n\n\treturn contentInlineStyles( deviceType );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;;AAExD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,eAAeA,CAAEC,UAAU,EAAG;EACrD,MAAM,CAAEC,WAAW,EAAEC,iBAAiB,CAAE,GAAGJ,QAAQ,CAAEK,MAAM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AO;UACNF,UAAU,EAAEJ,gBAAgB;UAC5BK,WAAW,EAAEL;QACd,CAAC;IACH;EACD,CAAC;EAED,OAAOH,mBAAmB,CAAEb,UAAW,CAAC;AACzC","ignoreList":[]}
1
+ {"version":3,"names":["useEffect","useState","useResizeCanvas","deviceType","actualWidth","updateActualWidth","window","innerWidth","resizeListener","addEventListener","removeEventListener","getCanvasWidth","device","deviceWidth","contentInlineStyles","height","marginVertical","marginHorizontal","width","marginTop","marginBottom","marginLeft","marginRight","overflowY"],"sources":["@wordpress/block-editor/src/components/use-resize-canvas/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\n\n/**\n * Function to resize the editor window.\n *\n * @param {string} deviceType Used for determining the size of the container (e.g. Desktop, Tablet, Mobile)\n *\n * @return {Object} Inline styles to be added to resizable container.\n */\nexport default function useResizeCanvas( deviceType ) {\n\tconst [ actualWidth, updateActualWidth ] = useState( window.innerWidth );\n\n\tuseEffect( () => {\n\t\tif ( deviceType === 'Desktop' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst resizeListener = () => updateActualWidth( window.innerWidth );\n\t\twindow.addEventListener( 'resize', resizeListener );\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener( 'resize', resizeListener );\n\t\t};\n\t}, [ deviceType ] );\n\n\tconst getCanvasWidth = ( device ) => {\n\t\tlet deviceWidth;\n\n\t\tswitch ( device ) {\n\t\t\tcase 'Tablet':\n\t\t\t\tdeviceWidth = 780;\n\t\t\t\tbreak;\n\t\t\tcase 'Mobile':\n\t\t\t\tdeviceWidth = 360;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn null;\n\t\t}\n\n\t\treturn deviceWidth < actualWidth ? deviceWidth : actualWidth;\n\t};\n\n\tconst contentInlineStyles = ( device ) => {\n\t\tconst height = device === 'Mobile' ? '768px' : '1024px';\n\t\tconst marginVertical = '40px';\n\t\tconst marginHorizontal = 'auto';\n\n\t\tswitch ( device ) {\n\t\t\tcase 'Tablet':\n\t\t\tcase 'Mobile':\n\t\t\t\treturn {\n\t\t\t\t\twidth: getCanvasWidth( device ),\n\t\t\t\t\t// Keeping margin styles separate to avoid warnings\n\t\t\t\t\t// when those props get overridden in the iframe component\n\t\t\t\t\tmarginTop: marginVertical,\n\t\t\t\t\tmarginBottom: marginVertical,\n\t\t\t\t\tmarginLeft: marginHorizontal,\n\t\t\t\t\tmarginRight: marginHorizontal,\n\t\t\t\t\theight,\n\t\t\t\t\toverflowY: 'auto',\n\t\t\t\t};\n\t\t\tdefault:\n\t\t\t\treturn {\n\t\t\t\t\tmarginLeft: marginHorizontal,\n\t\t\t\t\tmarginRight: marginHorizontal,\n\t\t\t\t};\n\t\t}\n\t};\n\n\treturn contentInlineStyles( deviceType );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;;AAExD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,eAAeA,CAAEC,UAAU,EAAG;EACrD,MAAM,CAAEC,WAAW,EAAEC,iBAAiB,CAAE,GAAGJ,QAAQ,CAAEK,MAAM,CAACC,UAAW,CAAC;EAExEP,SAAS,CAAE,MAAM;IAChB,IAAKG,UAAU,KAAK,SAAS,EAAG;MAC/B;IACD;IAEA,MAAMK,cAAc,GAAGA,CAAA,KAAMH,iBAAiB,CAAEC,MAAM,CAACC,UAAW,CAAC;IACnED,MAAM,CAACG,gBAAgB,CAAE,QAAQ,EAAED,cAAe,CAAC;IAEnD,OAAO,MAAM;MACZF,MAAM,CAACI,mBAAmB,CAAE,QAAQ,EAAEF,cAAe,CAAC;IACvD,CAAC;EACF,CAAC,EAAE,CAAEL,UAAU,CAAG,CAAC;EAEnB,MAAMQ,cAAc,GAAKC,MAAM,IAAM;IACpC,IAAIC,WAAW;IAEf,QAASD,MAAM;MACd,KAAK,QAAQ;QACZC,WAAW,GAAG,GAAG;QACjB;MACD,KAAK,QAAQ;QACZA,WAAW,GAAG,GAAG;QACjB;MACD;QACC,OAAO,IAAI;IACb;IAEA,OAAOA,WAAW,GAAGT,WAAW,GAAGS,WAAW,GAAGT,WAAW;EAC7D,CAAC;EAED,MAAMU,mBAAmB,GAAKF,MAAM,IAAM;IACzC,MAAMG,MAAM,GAAGH,MAAM,KAAK,QAAQ,GAAG,OAAO,GAAG,QAAQ;IACvD,MAAMI,cAAc,GAAG,MAAM;IAC7B,MAAMC,gBAAgB,GAAG,MAAM;IAE/B,QAASL,MAAM;MACd,KAAK,QAAQ;MACb,KAAK,QAAQ;QACZ,OAAO;UACNM,KAAK,EAAEP,cAAc,CAAEC,MAAO,CAAC;UAC/B;UACA;UACAO,SAAS,EAAEH,cAAc;UACzBI,YAAY,EAAEJ,cAAc;UAC5BK,UAAU,EAAEJ,gBAAgB;UAC5BK,WAAW,EAAEL,gBAAgB;UAC7BF,MAAM;UACNQ,SAAS,EAAE;QACZ,CAAC;MACF;QACC,OAAO;UACNF,UAAU,EAAEJ,gBAAgB;UAC5BK,WAAW,EAAEL;QACd,CAAC;IACH;EACD,CAAC;EAED,OAAOH,mBAAmB,CAAEX,UAAW,CAAC;AACzC","ignoreList":[]}
@@ -28,9 +28,7 @@ export function useSettings(...paths) {
28
28
  const {
29
29
  clientId = null
30
30
  } = useBlockEditContext();
31
- return useSelect(select => unlock(select(blockEditorStore)).getBlockSettings(clientId, ...paths),
32
- // eslint-disable-next-line react-hooks/exhaustive-deps
33
- [clientId, ...paths]);
31
+ return useSelect(select => unlock(select(blockEditorStore)).getBlockSettings(clientId, ...paths), [clientId, ...paths]);
34
32
  }
35
33
 
36
34
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","deprecated","useBlockEditContext","store","blockEditorStore","unlock","useSettings","paths","clientId","select","getBlockSettings","useSetting","path","since","alternative","note","value"],"sources":["@wordpress/block-editor/src/components/use-settings/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Hook that retrieves the given settings for the block instance in use.\n *\n * It looks up the settings first in the block instance hierarchy.\n * If none are found, it'll look them up in the block editor settings.\n *\n * @param {string[]} paths The paths to the settings.\n * @return {any[]} Returns the values defined for the settings.\n * @example\n * ```js\n * const [ fixed, sticky ] = useSettings( 'position.fixed', 'position.sticky' );\n * ```\n */\nexport function useSettings( ...paths ) {\n\tconst { clientId = null } = useBlockEditContext();\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tunlock( select( blockEditorStore ) ).getBlockSettings(\n\t\t\t\tclientId,\n\t\t\t\t...paths\n\t\t\t),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[ clientId, ...paths ]\n\t);\n}\n\n/**\n * Hook that retrieves the given setting for the block instance in use.\n *\n * It looks up the setting first in the block instance hierarchy.\n * If none is found, it'll look it up in the block editor settings.\n *\n * @deprecated 6.5.0 Use useSettings instead.\n *\n * @param {string} path The path to the setting.\n * @return {any} Returns the value defined for the setting.\n * @example\n * ```js\n * const isEnabled = useSetting( 'typography.dropCap' );\n * ```\n */\nexport function useSetting( path ) {\n\tdeprecated( 'wp.blockEditor.useSetting', {\n\t\tsince: '6.5',\n\t\talternative: 'wp.blockEditor.useSettings',\n\t\tnote: 'The new useSettings function can retrieve multiple settings at once, with better performance.',\n\t} );\n\n\tconst [ value ] = useSettings( path );\n\treturn value;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,SAASC,mBAAmB,QAAQ,eAAe;AACnD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,MAAM,QAAQ,mBAAmB;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAAE,GAAGC,KAAK,EAAG;EACvC,MAAM;IAAEC,QAAQ,GAAG;EAAK,CAAC,GAAGN,mBAAmB,CAAC,CAAC;EACjD,OAAOF,SAAS,CACbS,MAAM,IACPJ,MAAM,CAAEI,MAAM,CAAEL,gBAAiB,CAAE,CAAC,CAACM,gBAAgB,CACpDF,QAAQ,EACR,GAAGD,KACJ,CAAC;EACF;EACA,CAAEC,QAAQ,EAAE,GAAGD,KAAK,CACrB,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,UAAUA,CAAEC,IAAI,EAAG;EAClCX,UAAU,CAAE,2BAA2B,EAAE;IACxCY,KAAK,EAAE,KAAK;IACZC,WAAW,EAAE,4BAA4B;IACzCC,IAAI,EAAE;EACP,CAAE,CAAC;EAEH,MAAM,CAAEC,KAAK,CAAE,GAAGV,WAAW,CAAEM,IAAK,CAAC;EACrC,OAAOI,KAAK;AACb","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","deprecated","useBlockEditContext","store","blockEditorStore","unlock","useSettings","paths","clientId","select","getBlockSettings","useSetting","path","since","alternative","note","value"],"sources":["@wordpress/block-editor/src/components/use-settings/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Hook that retrieves the given settings for the block instance in use.\n *\n * It looks up the settings first in the block instance hierarchy.\n * If none are found, it'll look them up in the block editor settings.\n *\n * @param {string[]} paths The paths to the settings.\n * @return {any[]} Returns the values defined for the settings.\n * @example\n * ```js\n * const [ fixed, sticky ] = useSettings( 'position.fixed', 'position.sticky' );\n * ```\n */\nexport function useSettings( ...paths ) {\n\tconst { clientId = null } = useBlockEditContext();\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tunlock( select( blockEditorStore ) ).getBlockSettings(\n\t\t\t\tclientId,\n\t\t\t\t...paths\n\t\t\t),\n\t\t[ clientId, ...paths ]\n\t);\n}\n\n/**\n * Hook that retrieves the given setting for the block instance in use.\n *\n * It looks up the setting first in the block instance hierarchy.\n * If none is found, it'll look it up in the block editor settings.\n *\n * @deprecated 6.5.0 Use useSettings instead.\n *\n * @param {string} path The path to the setting.\n * @return {any} Returns the value defined for the setting.\n * @example\n * ```js\n * const isEnabled = useSetting( 'typography.dropCap' );\n * ```\n */\nexport function useSetting( path ) {\n\tdeprecated( 'wp.blockEditor.useSetting', {\n\t\tsince: '6.5',\n\t\talternative: 'wp.blockEditor.useSettings',\n\t\tnote: 'The new useSettings function can retrieve multiple settings at once, with better performance.',\n\t} );\n\n\tconst [ value ] = useSettings( path );\n\treturn value;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,SAASC,mBAAmB,QAAQ,eAAe;AACnD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,MAAM,QAAQ,mBAAmB;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAAE,GAAGC,KAAK,EAAG;EACvC,MAAM;IAAEC,QAAQ,GAAG;EAAK,CAAC,GAAGN,mBAAmB,CAAC,CAAC;EACjD,OAAOF,SAAS,CACbS,MAAM,IACPJ,MAAM,CAAEI,MAAM,CAAEL,gBAAiB,CAAE,CAAC,CAACM,gBAAgB,CACpDF,QAAQ,EACR,GAAGD,KACJ,CAAC,EACF,CAAEC,QAAQ,EAAE,GAAGD,KAAK,CACrB,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,UAAUA,CAAEC,IAAI,EAAG;EAClCX,UAAU,CAAE,2BAA2B,EAAE;IACxCY,KAAK,EAAE,KAAK;IACZC,WAAW,EAAE,4BAA4B;IACzCC,IAAI,EAAE;EACP,CAAE,CAAC;EAEH,MAAM,CAAEC,KAAK,CAAE,GAAGV,WAAW,CAAEM,IAAK,CAAC;EACrC,OAAOI,KAAK;AACb","ignoreList":[]}
@@ -18,8 +18,7 @@ import styles from './styles.scss';
18
18
  import PlayIcon from './gridicon-play';
19
19
 
20
20
  // Default Video ratio 16:9
21
- import { jsx as _jsx } from "react/jsx-runtime";
22
- import { jsxs as _jsxs } from "react/jsx-runtime";
21
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
23
22
  export const VIDEO_ASPECT_RATIO = 16 / 9;
24
23
  class Video extends Component {
25
24
  constructor() {
@@ -1 +1 @@
1
- {"version":3,"names":["Component","Icon","__","View","TouchableOpacity","Platform","Linking","Alert","default","VideoPlayer","styles","PlayIcon","jsx","_jsx","jsxs","_jsxs","VIDEO_ASPECT_RATIO","Video","constructor","arguments","isIOS","OS","state","isFullScreen","videoContainerHeight","onPressPlay","bind","onVideoLayout","event","height","nativeEvent","layout","setState","player","presentFullscreenPlayer","source","props","uri","openURL","url","canOpenURL","then","supported","alert","window","console","warn","catch","err","error","render","isSelected","style","showPlayButton","videoContainer","children","ref","controls","ignoreSilentSwitch","paused","onLayout","onFullscreenPlayerWillPresent","onFullscreenPlayerDidDismiss","disabled","onPress","overlayContainer","blackOverlay","icon","playIcon","size"],"sources":["@wordpress/block-editor/src/components/video-player/index.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { Icon } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * External dependencies\n */\nimport { View, TouchableOpacity, Platform, Linking, Alert } from 'react-native';\nimport { default as VideoPlayer } from 'react-native-video';\n\n/**\n * Internal dependencies\n */\nimport styles from './styles.scss';\nimport PlayIcon from './gridicon-play';\n\n// Default Video ratio 16:9\nexport const VIDEO_ASPECT_RATIO = 16 / 9;\n\nclass Video extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.isIOS = Platform.OS === 'ios';\n\t\tthis.state = {\n\t\t\tisFullScreen: false,\n\t\t\tvideoContainerHeight: 0,\n\t\t};\n\t\tthis.onPressPlay = this.onPressPlay.bind( this );\n\t\tthis.onVideoLayout = this.onVideoLayout.bind( this );\n\t}\n\n\tonVideoLayout( event ) {\n\t\tconst { height } = event.nativeEvent.layout;\n\t\tif ( height !== this.state.videoContainerHeight ) {\n\t\t\tthis.setState( { videoContainerHeight: height } );\n\t\t}\n\t}\n\n\tonPressPlay() {\n\t\tif ( this.isIOS ) {\n\t\t\tif ( this.player ) {\n\t\t\t\tthis.player.presentFullscreenPlayer();\n\t\t\t}\n\t\t} else {\n\t\t\tconst { source } = this.props;\n\t\t\tif ( source && source.uri ) {\n\t\t\t\tthis.openURL( source.uri );\n\t\t\t}\n\t\t}\n\t}\n\n\t// Tries opening the URL outside of the app\n\topenURL( url ) {\n\t\tLinking.canOpenURL( url )\n\t\t\t.then( ( supported ) => {\n\t\t\t\tif ( ! supported ) {\n\t\t\t\t\tAlert.alert(\n\t\t\t\t\t\t__( 'Problem opening the video' ),\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'No application can handle this request. Please install a Web browser.'\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t\twindow.console.warn(\n\t\t\t\t\t\t'No application found that can open the video with URL: ' +\n\t\t\t\t\t\t\turl\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\treturn Linking.openURL( url );\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( ( err ) => {\n\t\t\t\tAlert.alert(\n\t\t\t\t\t__( 'Problem opening the video' ),\n\t\t\t\t\t__( 'An unknown error occurred. Please try again.' )\n\t\t\t\t);\n\t\t\t\twindow.console.error(\n\t\t\t\t\t'An error occurred while opening the video URL: ' + url,\n\t\t\t\t\terr\n\t\t\t\t);\n\t\t\t} );\n\t}\n\n\trender() {\n\t\tconst { isSelected, style } = this.props;\n\t\tconst { isFullScreen, videoContainerHeight } = this.state;\n\t\tconst showPlayButton = videoContainerHeight > 0;\n\n\t\treturn (\n\t\t\t<View style={ styles.videoContainer }>\n\t\t\t\t<VideoPlayer\n\t\t\t\t\t{ ...this.props }\n\t\t\t\t\tref={ ( ref ) => {\n\t\t\t\t\t\tthis.player = ref;\n\t\t\t\t\t} }\n\t\t\t\t\t// Using built-in player controls is messing up the layout on iOS.\n\t\t\t\t\t// So we are setting controls=false and adding a play button that\n\t\t\t\t\t// will trigger presentFullscreenPlayer()\n\t\t\t\t\tcontrols={ false }\n\t\t\t\t\tignoreSilentSwitch=\"ignore\"\n\t\t\t\t\tpaused={ ! isFullScreen }\n\t\t\t\t\tonLayout={ this.onVideoLayout }\n\t\t\t\t\tonFullscreenPlayerWillPresent={ () => {\n\t\t\t\t\t\tthis.setState( { isFullScreen: true } );\n\t\t\t\t\t} }\n\t\t\t\t\tonFullscreenPlayerDidDismiss={ () => {\n\t\t\t\t\t\tthis.setState( { isFullScreen: false } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t{ showPlayButton && (\n\t\t\t\t\t// If we add the play icon as a subview to VideoPlayer then react-native-video decides to show control buttons\n\t\t\t\t\t// even if we set controls={ false }, so we are adding our play button as a sibling overlay view.\n\t\t\t\t\t<TouchableOpacity\n\t\t\t\t\t\tdisabled={ ! isSelected }\n\t\t\t\t\t\tonPress={ this.onPressPlay }\n\t\t\t\t\t\tstyle={ [ style, styles.overlayContainer ] }\n\t\t\t\t\t>\n\t\t\t\t\t\t<View style={ styles.blackOverlay } />\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\ticon={ PlayIcon }\n\t\t\t\t\t\t\tstyle={ styles.playIcon }\n\t\t\t\t\t\t\tsize={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AAoB,GAAG,CAAC;IAE/C,oBACCT,KAAA,CAACZ,IAAI;MAACiD,KAAK,EAAG1C,MAAM,CAAC4C,cAAgB;MAAAC,QAAA,gBACpC1C,IAAA,CAACJ,WAAW;QAAA,GACN,IAAI,CAAC2B,KAAK;QACfoB,GAAG,EAAKA,GAAG,IAAM;UAChB,IAAI,CAACvB,MAAM,GAAGuB,GAAG;QAClB;QACA;QACA;QACA;QAAA;QACAC,QAAQ,EAAG,KAAO;QAClBC,kBAAkB,EAAC,QAAQ;QAC3BC,MAAM,EAAG,CAAEpC,YAAc;QACzBqC,QAAQ,EAAG,IAAI,CAACjC,aAAe;QAC/BkC,6BAA6B,EAAGA,CAAA,KAAM;UACrC,IAAI,CAAC7B,QAAQ,CAAE;YAAET,YAAY,EAAE;UAAK,CAAE,CAAC;QACxC,CAAG;QACHuC,4BAA4B,EAAGA,CAAA,KAAM;UACpC,IAAI,CAAC9B,QAAQ,CAAE;YAAET,YAAY,EAAE;UAAM,CAAE,CAAC;QACzC;MAAG,CACH,CAAC,EACA8B,cAAc;MAAA;MACf;MACA;MACAtC,KAAA,CAACX,gBAAgB;QAChB2D,QAAQ,EAAG,CAAEZ,UAAY;QACzBa,OAAO,EAAG,IAAI,CAACvC,WAAa;QAC5B2B,KAAK,EAAG,CAAEA,KAAK,EAAE1C,MAAM,CAACuD,gBAAgB,CAAI;QAAAV,QAAA,gBAE5C1C,IAAA,CAACV,IAAI;UAACiD,KAAK,EAAG1C,MAAM,CAACwD;QAAc,CAAE,CAAC,eACtCrD,IAAA,CAACZ,IAAI;UACJkE,IAAI,EAAGxD,QAAU;UACjByC,KAAK,EAAG1C,MAAM,CAAC0D,QAAU;UACzBC,IAAI,EAAG3D,MAAM,CAAC0D,QAAQ,CAACC;QAAM,CAC7B,CAAC;MAAA,CACe,CAClB;IAAA,CACI,CAAC;EAET;AACD;AAEA,eAAepD,KAAK","ignoreList":[]}
1
+ {"version":3,"names":["Component","Icon","__","View","TouchableOpacity","Platform","Linking","Alert","default","VideoPlayer","styles","PlayIcon","jsx","_jsx","jsxs","_jsxs","VIDEO_ASPECT_RATIO","Video","constructor","arguments","isIOS","OS","state","isFullScreen","videoContainerHeight","onPressPlay","bind","onVideoLayout","event","height","nativeEvent","layout","setState","player","presentFullscreenPlayer","source","props","uri","openURL","url","canOpenURL","then","supported","alert","window","console","warn","catch","err","error","render","isSelected","style","showPlayButton","videoContainer","children","ref","controls","ignoreSilentSwitch","paused","onLayout","onFullscreenPlayerWillPresent","onFullscreenPlayerDidDismiss","disabled","onPress","overlayContainer","blackOverlay","icon","playIcon","size"],"sources":["@wordpress/block-editor/src/components/video-player/index.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { Icon } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * External dependencies\n */\nimport { View, TouchableOpacity, Platform, Linking, Alert } from 'react-native';\nimport { default as VideoPlayer } from 'react-native-video';\n\n/**\n * Internal dependencies\n */\nimport styles from './styles.scss';\nimport PlayIcon from './gridicon-play';\n\n// Default Video ratio 16:9\nexport const VIDEO_ASPECT_RATIO = 16 / 9;\n\nclass Video extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.isIOS = Platform.OS === 'ios';\n\t\tthis.state = {\n\t\t\tisFullScreen: false,\n\t\t\tvideoContainerHeight: 0,\n\t\t};\n\t\tthis.onPressPlay = this.onPressPlay.bind( this );\n\t\tthis.onVideoLayout = this.onVideoLayout.bind( this );\n\t}\n\n\tonVideoLayout( event ) {\n\t\tconst { height } = event.nativeEvent.layout;\n\t\tif ( height !== this.state.videoContainerHeight ) {\n\t\t\tthis.setState( { videoContainerHeight: height } );\n\t\t}\n\t}\n\n\tonPressPlay() {\n\t\tif ( this.isIOS ) {\n\t\t\tif ( this.player ) {\n\t\t\t\tthis.player.presentFullscreenPlayer();\n\t\t\t}\n\t\t} else {\n\t\t\tconst { source } = this.props;\n\t\t\tif ( source && source.uri ) {\n\t\t\t\tthis.openURL( source.uri );\n\t\t\t}\n\t\t}\n\t}\n\n\t// Tries opening the URL outside of the app\n\topenURL( url ) {\n\t\tLinking.canOpenURL( url )\n\t\t\t.then( ( supported ) => {\n\t\t\t\tif ( ! supported ) {\n\t\t\t\t\tAlert.alert(\n\t\t\t\t\t\t__( 'Problem opening the video' ),\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'No application can handle this request. Please install a Web browser.'\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t\twindow.console.warn(\n\t\t\t\t\t\t'No application found that can open the video with URL: ' +\n\t\t\t\t\t\t\turl\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\treturn Linking.openURL( url );\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( ( err ) => {\n\t\t\t\tAlert.alert(\n\t\t\t\t\t__( 'Problem opening the video' ),\n\t\t\t\t\t__( 'An unknown error occurred. Please try again.' )\n\t\t\t\t);\n\t\t\t\twindow.console.error(\n\t\t\t\t\t'An error occurred while opening the video URL: ' + url,\n\t\t\t\t\terr\n\t\t\t\t);\n\t\t\t} );\n\t}\n\n\trender() {\n\t\tconst { isSelected, style } = this.props;\n\t\tconst { isFullScreen, videoContainerHeight } = this.state;\n\t\tconst showPlayButton = videoContainerHeight > 0;\n\n\t\treturn (\n\t\t\t<View style={ styles.videoContainer }>\n\t\t\t\t<VideoPlayer\n\t\t\t\t\t{ ...this.props }\n\t\t\t\t\tref={ ( ref ) => {\n\t\t\t\t\t\tthis.player = ref;\n\t\t\t\t\t} }\n\t\t\t\t\t// Using built-in player controls is messing up the layout on iOS.\n\t\t\t\t\t// So we are setting controls=false and adding a play button that\n\t\t\t\t\t// will trigger presentFullscreenPlayer()\n\t\t\t\t\tcontrols={ false }\n\t\t\t\t\tignoreSilentSwitch=\"ignore\"\n\t\t\t\t\tpaused={ ! isFullScreen }\n\t\t\t\t\tonLayout={ this.onVideoLayout }\n\t\t\t\t\tonFullscreenPlayerWillPresent={ () => {\n\t\t\t\t\t\tthis.setState( { isFullScreen: true } );\n\t\t\t\t\t} }\n\t\t\t\t\tonFullscreenPlayerDidDismiss={ () => {\n\t\t\t\t\t\tthis.setState( { isFullScreen: false } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t{ showPlayButton && (\n\t\t\t\t\t// If we add the play icon as a subview to VideoPlayer then react-native-video decides to show control buttons\n\t\t\t\t\t// even if we set controls={ false }, so we are adding our play button as a sibling overlay view.\n\t\t\t\t\t<TouchableOpacity\n\t\t\t\t\t\tdisabled={ ! isSelected }\n\t\t\t\t\t\tonPress={ this.onPressPlay }\n\t\t\t\t\t\tstyle={ [ style, styles.overlayContainer ] }\n\t\t\t\t\t>\n\t\t\t\t\t\t<View style={ styles.blackOverlay } />\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\ticon={ PlayIcon }\n\t\t\t\t\t\t\tstyle={ styles.playIcon }\n\t\t\t\t\t\t\tsize={ styles.playIcon.size }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</TouchableOpacity>\n\t\t\t\t) }\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nexport default Video;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,IAAI,EAAEC,gBAAgB,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,KAAK,QAAQ,cAAc;AAC/E,SAASC,OAAO,IAAIC,WAAW,QAAQ,oBAAoB;;AAE3D;AACA;AACA;AACA,OAAOC,MAAM,MAAM,eAAe;AAClC,OAAOC,QAAQ,MAAM,iBAAiB;;AAEtC;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AACA,OAAO,MAAMC,kBAAkB,GAAG,EAAE,GAAG,CAAC;AAExC,MAAMC,KAAK,SAASjB,SAAS,CA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