@wordpress/block-editor 13.3.0 → 14.0.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 (554) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +11 -5
  3. package/build/components/alignment-control/ui.js +2 -2
  4. package/build/components/alignment-control/ui.js.map +1 -1
  5. package/build/components/block-alignment-control/ui.js +1 -1
  6. package/build/components/block-alignment-control/ui.js.map +1 -1
  7. package/build/components/block-alignment-control/ui.native.js +1 -1
  8. package/build/components/block-alignment-control/ui.native.js.map +1 -1
  9. package/build/components/block-breadcrumb/index.js +3 -1
  10. package/build/components/block-breadcrumb/index.js.map +1 -1
  11. package/build/components/block-draggable/index.js +2 -2
  12. package/build/components/block-draggable/index.js.map +1 -1
  13. package/build/components/block-inspector/index.js +6 -3
  14. package/build/components/block-inspector/index.js.map +1 -1
  15. package/build/components/block-list/use-block-props/index.js +3 -1
  16. package/build/components/block-list/use-block-props/index.js.map +1 -1
  17. package/build/components/block-list/use-block-props/use-block-refs.js +26 -27
  18. package/build/components/block-list/use-block-props/use-block-refs.js.map +1 -1
  19. package/build/components/block-list/use-block-props/use-is-hovered.js +25 -9
  20. package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
  21. package/build/components/block-list/use-in-between-inserter.js +3 -2
  22. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  23. package/build/components/block-lock/modal.js +2 -0
  24. package/build/components/block-lock/modal.js.map +1 -1
  25. package/build/components/block-mover/index.js +1 -2
  26. package/build/components/block-mover/index.js.map +1 -1
  27. package/build/components/block-popover/cover.js +1 -1
  28. package/build/components/block-popover/cover.js.map +1 -1
  29. package/build/components/block-popover/inbetween.js +2 -2
  30. package/build/components/block-popover/inbetween.js.map +1 -1
  31. package/build/components/block-popover/index.js +2 -2
  32. package/build/components/block-popover/index.js.map +1 -1
  33. package/build/components/block-removal-warning-modal/index.js +2 -0
  34. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  35. package/build/components/block-switcher/index.js +1 -1
  36. package/build/components/block-switcher/index.js.map +1 -1
  37. package/build/components/block-switcher/pattern-transformations-menu.js +11 -12
  38. package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  39. package/build/components/block-switcher/preview-block-popover.js +20 -17
  40. package/build/components/block-switcher/preview-block-popover.js.map +1 -1
  41. package/build/components/block-toolbar/shuffle.js +5 -2
  42. package/build/components/block-toolbar/shuffle.js.map +1 -1
  43. package/build/components/block-tools/block-selection-button.js +1 -2
  44. package/build/components/block-tools/block-selection-button.js.map +1 -1
  45. package/build/components/block-tools/index.js +1 -1
  46. package/build/components/block-tools/index.js.map +1 -1
  47. package/build/components/block-tools/use-block-toolbar-popover-props.js +1 -1
  48. package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  49. package/build/components/block-tools/use-show-block-tools.js +7 -8
  50. package/build/components/block-tools/use-show-block-tools.js.map +1 -1
  51. package/build/components/block-tools/zoom-out-mode-inserter-button.js +45 -0
  52. package/build/components/block-tools/zoom-out-mode-inserter-button.js.map +1 -0
  53. package/build/components/block-tools/zoom-out-mode-inserters.js +35 -36
  54. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  55. package/build/components/block-tools/zoom-out-popover.js +2 -1
  56. package/build/components/block-tools/zoom-out-popover.js.map +1 -1
  57. package/build/components/block-tools/zoom-out-toolbar.js +1 -2
  58. package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
  59. package/build/components/child-layout-control/index.js +3 -1
  60. package/build/components/child-layout-control/index.js.map +1 -1
  61. package/build/components/date-format-picker/index.js +2 -11
  62. package/build/components/date-format-picker/index.js.map +1 -1
  63. package/build/components/default-block-appender/index.js +7 -4
  64. package/build/components/default-block-appender/index.js.map +1 -1
  65. package/build/components/dimensions-tool/scale-tool.js +1 -0
  66. package/build/components/dimensions-tool/scale-tool.js.map +1 -1
  67. package/build/components/font-appearance-control/index.js +2 -7
  68. package/build/components/font-appearance-control/index.js.map +1 -1
  69. package/build/components/font-family/index.js +12 -0
  70. package/build/components/font-family/index.js.map +1 -1
  71. package/build/components/global-styles/background-panel.js +63 -52
  72. package/build/components/global-styles/background-panel.js.map +1 -1
  73. package/build/components/global-styles/hooks.js +5 -1
  74. package/build/components/global-styles/hooks.js.map +1 -1
  75. package/build/components/global-styles/image-settings-panel.js +1 -0
  76. package/build/components/global-styles/image-settings-panel.js.map +1 -1
  77. package/build/components/global-styles/theme-file-uri-utils.js +0 -59
  78. package/build/components/global-styles/theme-file-uri-utils.js.map +1 -1
  79. package/build/components/global-styles/typography-panel.js +26 -44
  80. package/build/components/global-styles/typography-panel.js.map +1 -1
  81. package/build/components/global-styles/typography-utils.js +78 -7
  82. package/build/components/global-styles/typography-utils.js.map +1 -1
  83. package/build/components/global-styles/use-global-styles-output.js +82 -44
  84. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  85. package/build/components/global-styles/utils.js +96 -0
  86. package/build/components/global-styles/utils.js.map +1 -1
  87. package/build/components/grid/grid-item-movers.js +93 -44
  88. package/build/components/grid/grid-item-movers.js.map +1 -1
  89. package/build/components/grid/grid-item-resizer.js +14 -15
  90. package/build/components/grid/grid-item-resizer.js.map +1 -1
  91. package/build/components/grid/grid-visualizer.js +2 -2
  92. package/build/components/grid/grid-visualizer.js.map +1 -1
  93. package/build/components/grid/use-grid-layout-sync.js +93 -45
  94. package/build/components/grid/use-grid-layout-sync.js.map +1 -1
  95. package/build/components/iframe/index.js +4 -8
  96. package/build/components/iframe/index.js.map +1 -1
  97. package/build/components/index.js +1 -9
  98. package/build/components/index.js.map +1 -1
  99. package/build/components/inner-blocks/index.js +1 -1
  100. package/build/components/inner-blocks/index.js.map +1 -1
  101. package/build/components/inserter/block-patterns-tab/patterns-filter.js +20 -23
  102. package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  103. package/build/components/inserter/category-tabs/index.js +29 -2
  104. package/build/components/inserter/category-tabs/index.js.map +1 -1
  105. package/build/components/inserter/media-tab/media-panel.js +1 -0
  106. package/build/components/inserter/media-tab/media-panel.js.map +1 -1
  107. package/build/components/inserter/menu.js +3 -3
  108. package/build/components/inserter/menu.js.map +1 -1
  109. package/build/components/inserter/preview-panel.js +20 -3
  110. package/build/components/inserter/preview-panel.js.map +1 -1
  111. package/build/components/inserter-draggable-blocks/index.js +10 -3
  112. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  113. package/build/components/inspector-controls-tabs/settings-tab.js +1 -2
  114. package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -1
  115. package/build/components/line-height-control/index.js +0 -15
  116. package/build/components/line-height-control/index.js.map +1 -1
  117. package/build/components/link-control/search-input.js +0 -1
  118. package/build/components/link-control/search-input.js.map +1 -1
  119. package/build/components/list-view/block-select-button.js +2 -6
  120. package/build/components/list-view/block-select-button.js.map +1 -1
  121. package/build/components/list-view/block.js +2 -2
  122. package/build/components/list-view/block.js.map +1 -1
  123. package/build/components/list-view/utils.js +3 -1
  124. package/build/components/list-view/utils.js.map +1 -1
  125. package/build/components/media-replace-flow/index.js +3 -1
  126. package/build/components/media-replace-flow/index.js.map +1 -1
  127. package/build/components/resolution-tool/index.js +1 -0
  128. package/build/components/resolution-tool/index.js.map +1 -1
  129. package/build/components/rich-text/format-toolbar/index.js +1 -1
  130. package/build/components/rich-text/format-toolbar/index.js.map +1 -1
  131. package/build/components/rich-text/index.js +1 -1
  132. package/build/components/rich-text/index.js.map +1 -1
  133. package/build/components/skip-to-selected-block/index.js +4 -2
  134. package/build/components/skip-to-selected-block/index.js.map +1 -1
  135. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +8 -8
  136. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  137. package/build/components/url-input/button.js +0 -1
  138. package/build/components/url-input/button.js.map +1 -1
  139. package/build/components/url-input/index.js +1 -11
  140. package/build/components/url-input/index.js.map +1 -1
  141. package/build/components/url-popover/image-url-input-ui.js +3 -3
  142. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  143. package/build/components/url-popover/link-editor.js +0 -1
  144. package/build/components/url-popover/link-editor.js.map +1 -1
  145. package/build/components/use-block-drop-zone/index.js +30 -4
  146. package/build/components/use-block-drop-zone/index.js.map +1 -1
  147. package/build/components/use-on-block-drop/index.js +3 -6
  148. package/build/components/use-on-block-drop/index.js.map +1 -1
  149. package/build/components/use-resize-canvas/index.js +1 -3
  150. package/build/components/use-resize-canvas/index.js.map +1 -1
  151. package/build/components/use-settings/index.js +2 -1
  152. package/build/components/use-settings/index.js.map +1 -1
  153. package/build/hooks/block-bindings.js +248 -36
  154. package/build/hooks/block-bindings.js.map +1 -1
  155. package/build/hooks/block-hooks.js +1 -0
  156. package/build/hooks/block-hooks.js.map +1 -1
  157. package/build/hooks/block-style-variation.js +2 -2
  158. package/build/hooks/block-style-variation.js.map +1 -1
  159. package/build/hooks/contrast-checker.js +6 -6
  160. package/build/hooks/contrast-checker.js.map +1 -1
  161. package/build/hooks/duotone.js +3 -3
  162. package/build/hooks/duotone.js.map +1 -1
  163. package/build/hooks/grid-visualizer.js +5 -8
  164. package/build/hooks/grid-visualizer.js.map +1 -1
  165. package/build/hooks/index.js +7 -1
  166. package/build/hooks/index.js.map +1 -1
  167. package/build/hooks/layout-child.js +9 -2
  168. package/build/hooks/layout-child.js.map +1 -1
  169. package/build/hooks/line-height.js +0 -1
  170. package/build/hooks/line-height.js.map +1 -1
  171. package/build/hooks/position.js +3 -7
  172. package/build/hooks/position.js.map +1 -1
  173. package/build/hooks/spacing-visualizer.js +1 -1
  174. package/build/hooks/spacing-visualizer.js.map +1 -1
  175. package/build/hooks/use-bindings-attributes.js +85 -50
  176. package/build/hooks/use-bindings-attributes.js.map +1 -1
  177. package/build/hooks/use-zoom-out.js +1 -1
  178. package/build/hooks/use-zoom-out.js.map +1 -1
  179. package/build/hooks/utils.js +20 -0
  180. package/build/hooks/utils.js.map +1 -1
  181. package/build/index.js +7 -0
  182. package/build/index.js.map +1 -1
  183. package/build/layouts/constrained.js +6 -2
  184. package/build/layouts/constrained.js.map +1 -1
  185. package/build/layouts/grid.js +2 -0
  186. package/build/layouts/grid.js.map +1 -1
  187. package/build/private-apis.js +0 -4
  188. package/build/private-apis.js.map +1 -1
  189. package/build/store/actions.js +27 -2
  190. package/build/store/actions.js.map +1 -1
  191. package/build/store/reducer.js +19 -1
  192. package/build/store/reducer.js.map +1 -1
  193. package/build/store/selectors.js +17 -5
  194. package/build/store/selectors.js.map +1 -1
  195. package/build/utils/get-editor-region.js +1 -1
  196. package/build/utils/get-editor-region.js.map +1 -1
  197. package/build/utils/get-px-from-css-unit.js +1 -1
  198. package/build/utils/get-px-from-css-unit.js.map +1 -1
  199. package/build-module/components/alignment-control/ui.js +2 -2
  200. package/build-module/components/alignment-control/ui.js.map +1 -1
  201. package/build-module/components/block-alignment-control/ui.js +1 -1
  202. package/build-module/components/block-alignment-control/ui.js.map +1 -1
  203. package/build-module/components/block-alignment-control/ui.native.js +1 -1
  204. package/build-module/components/block-alignment-control/ui.native.js.map +1 -1
  205. package/build-module/components/block-breadcrumb/index.js +4 -2
  206. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  207. package/build-module/components/block-draggable/index.js +3 -3
  208. package/build-module/components/block-draggable/index.js.map +1 -1
  209. package/build-module/components/block-inspector/index.js +6 -3
  210. package/build-module/components/block-inspector/index.js.map +1 -1
  211. package/build-module/components/block-list/use-block-props/index.js +3 -1
  212. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  213. package/build-module/components/block-list/use-block-props/use-block-refs.js +27 -30
  214. package/build-module/components/block-list/use-block-props/use-block-refs.js.map +1 -1
  215. package/build-module/components/block-list/use-block-props/use-is-hovered.js +26 -9
  216. package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
  217. package/build-module/components/block-list/use-in-between-inserter.js +3 -2
  218. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  219. package/build-module/components/block-lock/modal.js +2 -0
  220. package/build-module/components/block-lock/modal.js.map +1 -1
  221. package/build-module/components/block-mover/index.js +1 -2
  222. package/build-module/components/block-mover/index.js.map +1 -1
  223. package/build-module/components/block-popover/cover.js +1 -1
  224. package/build-module/components/block-popover/cover.js.map +1 -1
  225. package/build-module/components/block-popover/inbetween.js +1 -1
  226. package/build-module/components/block-popover/inbetween.js.map +1 -1
  227. package/build-module/components/block-popover/index.js +1 -1
  228. package/build-module/components/block-popover/index.js.map +1 -1
  229. package/build-module/components/block-removal-warning-modal/index.js +2 -0
  230. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  231. package/build-module/components/block-switcher/index.js +1 -1
  232. package/build-module/components/block-switcher/index.js.map +1 -1
  233. package/build-module/components/block-switcher/pattern-transformations-menu.js +12 -13
  234. package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  235. package/build-module/components/block-switcher/preview-block-popover.js +20 -17
  236. package/build-module/components/block-switcher/preview-block-popover.js.map +1 -1
  237. package/build-module/components/block-toolbar/shuffle.js +5 -2
  238. package/build-module/components/block-toolbar/shuffle.js.map +1 -1
  239. package/build-module/components/block-tools/block-selection-button.js +1 -2
  240. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  241. package/build-module/components/block-tools/index.js +1 -1
  242. package/build-module/components/block-tools/index.js.map +1 -1
  243. package/build-module/components/block-tools/use-block-toolbar-popover-props.js +1 -1
  244. package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  245. package/build-module/components/block-tools/use-show-block-tools.js +7 -8
  246. package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
  247. package/build-module/components/block-tools/zoom-out-mode-inserter-button.js +37 -0
  248. package/build-module/components/block-tools/zoom-out-mode-inserter-button.js.map +1 -0
  249. package/build-module/components/block-tools/zoom-out-mode-inserters.js +37 -38
  250. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  251. package/build-module/components/block-tools/zoom-out-popover.js +2 -1
  252. package/build-module/components/block-tools/zoom-out-popover.js.map +1 -1
  253. package/build-module/components/block-tools/zoom-out-toolbar.js +1 -2
  254. package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
  255. package/build-module/components/child-layout-control/index.js +3 -1
  256. package/build-module/components/child-layout-control/index.js.map +1 -1
  257. package/build-module/components/date-format-picker/index.js +4 -12
  258. package/build-module/components/date-format-picker/index.js.map +1 -1
  259. package/build-module/components/default-block-appender/index.js +7 -4
  260. package/build-module/components/default-block-appender/index.js.map +1 -1
  261. package/build-module/components/dimensions-tool/scale-tool.js +1 -0
  262. package/build-module/components/dimensions-tool/scale-tool.js.map +1 -1
  263. package/build-module/components/font-appearance-control/index.js +3 -6
  264. package/build-module/components/font-appearance-control/index.js.map +1 -1
  265. package/build-module/components/font-family/index.js +11 -0
  266. package/build-module/components/font-family/index.js.map +1 -1
  267. package/build-module/components/global-styles/background-panel.js +63 -52
  268. package/build-module/components/global-styles/background-panel.js.map +1 -1
  269. package/build-module/components/global-styles/hooks.js +5 -1
  270. package/build-module/components/global-styles/hooks.js.map +1 -1
  271. package/build-module/components/global-styles/image-settings-panel.js +1 -0
  272. package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
  273. package/build-module/components/global-styles/theme-file-uri-utils.js +0 -58
  274. package/build-module/components/global-styles/theme-file-uri-utils.js.map +1 -1
  275. package/build-module/components/global-styles/typography-panel.js +27 -45
  276. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  277. package/build-module/components/global-styles/typography-utils.js +76 -7
  278. package/build-module/components/global-styles/typography-utils.js.map +1 -1
  279. package/build-module/components/global-styles/use-global-styles-output.js +81 -43
  280. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  281. package/build-module/components/global-styles/utils.js +92 -0
  282. package/build-module/components/global-styles/utils.js.map +1 -1
  283. package/build-module/components/grid/grid-item-movers.js +96 -46
  284. package/build-module/components/grid/grid-item-movers.js.map +1 -1
  285. package/build-module/components/grid/grid-item-resizer.js +14 -15
  286. package/build-module/components/grid/grid-item-resizer.js.map +1 -1
  287. package/build-module/components/grid/grid-visualizer.js +2 -2
  288. package/build-module/components/grid/grid-visualizer.js.map +1 -1
  289. package/build-module/components/grid/use-grid-layout-sync.js +94 -46
  290. package/build-module/components/grid/use-grid-layout-sync.js.map +1 -1
  291. package/build-module/components/iframe/index.js +4 -8
  292. package/build-module/components/iframe/index.js.map +1 -1
  293. package/build-module/components/index.js +0 -5
  294. package/build-module/components/index.js.map +1 -1
  295. package/build-module/components/inner-blocks/index.js +1 -1
  296. package/build-module/components/inner-blocks/index.js.map +1 -1
  297. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +20 -23
  298. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  299. package/build-module/components/inserter/category-tabs/index.js +30 -3
  300. package/build-module/components/inserter/category-tabs/index.js.map +1 -1
  301. package/build-module/components/inserter/media-tab/media-panel.js +1 -0
  302. package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
  303. package/build-module/components/inserter/menu.js +3 -3
  304. package/build-module/components/inserter/menu.js.map +1 -1
  305. package/build-module/components/inserter/preview-panel.js +20 -3
  306. package/build-module/components/inserter/preview-panel.js.map +1 -1
  307. package/build-module/components/inserter-draggable-blocks/index.js +10 -3
  308. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  309. package/build-module/components/inspector-controls-tabs/settings-tab.js +1 -2
  310. package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -1
  311. package/build-module/components/line-height-control/index.js +0 -14
  312. package/build-module/components/line-height-control/index.js.map +1 -1
  313. package/build-module/components/link-control/search-input.js +0 -1
  314. package/build-module/components/link-control/search-input.js.map +1 -1
  315. package/build-module/components/list-view/block-select-button.js +3 -7
  316. package/build-module/components/list-view/block-select-button.js.map +1 -1
  317. package/build-module/components/list-view/block.js +2 -2
  318. package/build-module/components/list-view/block.js.map +1 -1
  319. package/build-module/components/list-view/utils.js +3 -1
  320. package/build-module/components/list-view/utils.js.map +1 -1
  321. package/build-module/components/media-replace-flow/index.js +3 -1
  322. package/build-module/components/media-replace-flow/index.js.map +1 -1
  323. package/build-module/components/resolution-tool/index.js +1 -0
  324. package/build-module/components/resolution-tool/index.js.map +1 -1
  325. package/build-module/components/rich-text/format-toolbar/index.js +1 -1
  326. package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
  327. package/build-module/components/rich-text/index.js +1 -1
  328. package/build-module/components/rich-text/index.js.map +1 -1
  329. package/build-module/components/skip-to-selected-block/index.js +5 -3
  330. package/build-module/components/skip-to-selected-block/index.js.map +1 -1
  331. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +8 -8
  332. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  333. package/build-module/components/url-input/button.js +0 -1
  334. package/build-module/components/url-input/button.js.map +1 -1
  335. package/build-module/components/url-input/index.js +1 -11
  336. package/build-module/components/url-input/index.js.map +1 -1
  337. package/build-module/components/url-popover/image-url-input-ui.js +3 -3
  338. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  339. package/build-module/components/url-popover/link-editor.js +0 -1
  340. package/build-module/components/url-popover/link-editor.js.map +1 -1
  341. package/build-module/components/use-block-drop-zone/index.js +30 -4
  342. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  343. package/build-module/components/use-on-block-drop/index.js +3 -6
  344. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  345. package/build-module/components/use-resize-canvas/index.js +1 -3
  346. package/build-module/components/use-resize-canvas/index.js.map +1 -1
  347. package/build-module/components/use-settings/index.js +2 -1
  348. package/build-module/components/use-settings/index.js.map +1 -1
  349. package/build-module/hooks/block-bindings.js +253 -40
  350. package/build-module/hooks/block-bindings.js.map +1 -1
  351. package/build-module/hooks/block-hooks.js +1 -0
  352. package/build-module/hooks/block-hooks.js.map +1 -1
  353. package/build-module/hooks/block-style-variation.js +3 -3
  354. package/build-module/hooks/block-style-variation.js.map +1 -1
  355. package/build-module/hooks/contrast-checker.js +7 -7
  356. package/build-module/hooks/contrast-checker.js.map +1 -1
  357. package/build-module/hooks/duotone.js +4 -4
  358. package/build-module/hooks/duotone.js.map +1 -1
  359. package/build-module/hooks/grid-visualizer.js +5 -8
  360. package/build-module/hooks/grid-visualizer.js.map +1 -1
  361. package/build-module/hooks/index.js +2 -1
  362. package/build-module/hooks/index.js.map +1 -1
  363. package/build-module/hooks/layout-child.js +9 -2
  364. package/build-module/hooks/layout-child.js.map +1 -1
  365. package/build-module/hooks/line-height.js +0 -1
  366. package/build-module/hooks/line-height.js.map +1 -1
  367. package/build-module/hooks/position.js +3 -7
  368. package/build-module/hooks/position.js.map +1 -1
  369. package/build-module/hooks/spacing-visualizer.js +1 -1
  370. package/build-module/hooks/spacing-visualizer.js.map +1 -1
  371. package/build-module/hooks/use-bindings-attributes.js +84 -51
  372. package/build-module/hooks/use-bindings-attributes.js.map +1 -1
  373. package/build-module/hooks/use-zoom-out.js +1 -1
  374. package/build-module/hooks/use-zoom-out.js.map +1 -1
  375. package/build-module/hooks/utils.js +19 -0
  376. package/build-module/hooks/utils.js.map +1 -1
  377. package/build-module/index.js +1 -1
  378. package/build-module/index.js.map +1 -1
  379. package/build-module/layouts/constrained.js +6 -2
  380. package/build-module/layouts/constrained.js.map +1 -1
  381. package/build-module/layouts/grid.js +2 -0
  382. package/build-module/layouts/grid.js.map +1 -1
  383. package/build-module/private-apis.js +1 -5
  384. package/build-module/private-apis.js.map +1 -1
  385. package/build-module/store/actions.js +24 -1
  386. package/build-module/store/actions.js.map +1 -1
  387. package/build-module/store/reducer.js +18 -1
  388. package/build-module/store/reducer.js.map +1 -1
  389. package/build-module/store/selectors.js +14 -4
  390. package/build-module/store/selectors.js.map +1 -1
  391. package/build-module/utils/get-editor-region.js +1 -1
  392. package/build-module/utils/get-editor-region.js.map +1 -1
  393. package/build-module/utils/get-px-from-css-unit.js +1 -1
  394. package/build-module/utils/get-px-from-css-unit.js.map +1 -1
  395. package/build-style/content-rtl.css +11 -18
  396. package/build-style/content.css +11 -18
  397. package/build-style/default-editor-styles-rtl.css +3 -0
  398. package/build-style/default-editor-styles.css +3 -0
  399. package/build-style/style-rtl.css +242 -136
  400. package/build-style/style.css +242 -136
  401. package/build-types/components/block-context/index.d.ts +2 -2
  402. package/build-types/components/block-context/index.d.ts.map +1 -1
  403. package/build-types/utils/dom.d.ts.map +1 -1
  404. package/package.json +31 -31
  405. package/src/autocompleters/style.scss +4 -0
  406. package/src/components/alignment-control/ui.js +2 -2
  407. package/src/components/block-alignment-control/ui.js +1 -1
  408. package/src/components/block-alignment-control/ui.native.js +1 -1
  409. package/src/components/block-breadcrumb/index.js +4 -2
  410. package/src/components/block-canvas/style.scss +1 -0
  411. package/src/components/block-context/README.md +4 -4
  412. package/src/components/block-draggable/index.js +3 -3
  413. package/src/components/block-inspector/index.js +8 -4
  414. package/src/components/block-list/content.scss +2 -16
  415. package/src/components/block-list/use-block-props/index.js +1 -1
  416. package/src/components/block-list/use-block-props/use-block-refs.js +30 -30
  417. package/src/components/block-list/use-block-props/use-is-hovered.js +26 -11
  418. package/src/components/block-list/use-in-between-inserter.js +5 -1
  419. package/src/components/block-lock/modal.js +10 -2
  420. package/src/components/block-lock/style.scss +4 -8
  421. package/src/components/block-mover/index.js +5 -2
  422. package/src/components/block-patterns-paging/style.scss +0 -23
  423. package/src/components/block-popover/cover.js +1 -1
  424. package/src/components/block-popover/inbetween.js +1 -1
  425. package/src/components/block-popover/index.js +1 -1
  426. package/src/components/block-removal-warning-modal/index.js +10 -2
  427. package/src/components/block-switcher/index.js +1 -1
  428. package/src/components/block-switcher/pattern-transformations-menu.js +17 -15
  429. package/src/components/block-switcher/preview-block-popover.js +20 -14
  430. package/src/components/block-switcher/style.scss +8 -17
  431. package/src/components/block-toolbar/shuffle.js +8 -1
  432. package/src/components/block-tools/block-selection-button.js +1 -2
  433. package/src/components/block-tools/index.js +5 -6
  434. package/src/components/block-tools/style.scss +8 -0
  435. package/src/components/block-tools/use-block-toolbar-popover-props.js +1 -1
  436. package/src/components/block-tools/use-show-block-tools.js +12 -9
  437. package/src/components/block-tools/zoom-out-mode-inserter-button.js +47 -0
  438. package/src/components/block-tools/zoom-out-mode-inserters.js +48 -42
  439. package/src/components/block-tools/zoom-out-popover.js +1 -0
  440. package/src/components/block-tools/zoom-out-toolbar.js +1 -2
  441. package/src/components/button-block-appender/content.scss +1 -1
  442. package/src/components/child-layout-control/index.js +2 -0
  443. package/src/components/color-palette/test/__snapshots__/control.js.snap +2 -2
  444. package/src/components/colors-gradients/test/control.js +3 -2
  445. package/src/components/date-format-picker/index.js +2 -11
  446. package/src/components/default-block-appender/index.js +11 -4
  447. package/src/components/dimensions-tool/scale-tool.js +1 -0
  448. package/src/components/font-appearance-control/index.js +1 -5
  449. package/src/components/font-family/README.md +8 -0
  450. package/src/components/font-family/index.js +16 -0
  451. package/src/components/font-family/stories/index.story.js +54 -0
  452. package/src/components/global-styles/background-panel.js +90 -62
  453. package/src/components/global-styles/hooks.js +5 -1
  454. package/src/components/global-styles/image-settings-panel.js +1 -0
  455. package/src/components/global-styles/style.scss +11 -9
  456. package/src/components/global-styles/test/theme-file-uri-utils.js +1 -26
  457. package/src/components/global-styles/test/typography-utils.js +325 -0
  458. package/src/components/global-styles/test/use-global-styles-output.js +52 -5
  459. package/src/components/global-styles/test/utils.js +120 -0
  460. package/src/components/global-styles/theme-file-uri-utils.js +0 -59
  461. package/src/components/global-styles/typography-panel.js +36 -45
  462. package/src/components/global-styles/typography-utils.js +103 -7
  463. package/src/components/global-styles/use-global-styles-output.js +89 -50
  464. package/src/components/global-styles/utils.js +112 -0
  465. package/src/components/grid/grid-item-movers.js +141 -69
  466. package/src/components/grid/grid-item-resizer.js +11 -17
  467. package/src/components/grid/grid-visualizer.js +2 -2
  468. package/src/components/grid/style.scss +164 -0
  469. package/src/components/grid/use-grid-layout-sync.js +133 -40
  470. package/src/components/iframe/content.scss +3 -3
  471. package/src/components/iframe/index.js +3 -7
  472. package/src/components/index.js +0 -5
  473. package/src/components/inner-blocks/index.js +4 -1
  474. package/src/components/inserter/block-patterns-tab/patterns-filter.js +40 -44
  475. package/src/components/inserter/category-tabs/index.js +35 -2
  476. package/src/components/inserter/media-tab/media-panel.js +1 -0
  477. package/src/components/inserter/menu.js +3 -3
  478. package/src/components/inserter/preview-panel.js +27 -4
  479. package/src/components/inserter/style.scss +66 -47
  480. package/src/components/inserter-draggable-blocks/index.js +11 -3
  481. package/src/components/inspector-controls/README.md +5 -0
  482. package/src/components/inspector-controls-tabs/settings-tab.js +0 -2
  483. package/src/components/inspector-controls-tabs/style.scss +0 -21
  484. package/src/components/line-height-control/README.md +0 -8
  485. package/src/components/line-height-control/index.js +1 -21
  486. package/src/components/line-height-control/stories/index.story.js +0 -1
  487. package/src/components/line-height-control/test/index.js +1 -7
  488. package/src/components/link-control/search-input.js +0 -1
  489. package/src/components/list-view/block-select-button.js +3 -13
  490. package/src/components/list-view/block.js +10 -3
  491. package/src/components/list-view/style.scss +2 -1
  492. package/src/components/list-view/utils.js +13 -2
  493. package/src/components/media-replace-flow/README.md +7 -0
  494. package/src/components/media-replace-flow/index.js +3 -1
  495. package/src/components/resolution-tool/index.js +1 -0
  496. package/src/components/responsive-block-control/test/index.js +5 -1
  497. package/src/components/rich-text/format-toolbar/index.js +1 -1
  498. package/src/components/rich-text/index.js +1 -1
  499. package/src/components/skip-to-selected-block/index.js +5 -3
  500. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +6 -7
  501. package/src/components/tabbed-sidebar/style.scss +1 -19
  502. package/src/components/url-input/README.md +0 -5
  503. package/src/components/url-input/button.js +0 -1
  504. package/src/components/url-input/index.js +1 -15
  505. package/src/components/url-popover/image-url-input-ui.js +3 -3
  506. package/src/components/url-popover/link-editor.js +0 -1
  507. package/src/components/url-popover/style.scss +1 -0
  508. package/src/components/use-block-drop-zone/index.js +66 -14
  509. package/src/components/use-on-block-drop/index.js +1 -9
  510. package/src/components/use-resize-canvas/index.js +1 -3
  511. package/src/components/use-settings/index.js +2 -1
  512. package/src/hooks/block-bindings.js +303 -52
  513. package/src/hooks/block-bindings.scss +13 -2
  514. package/src/hooks/block-hooks.js +1 -0
  515. package/src/hooks/block-hooks.scss +1 -0
  516. package/src/hooks/block-style-variation.js +3 -3
  517. package/src/hooks/contrast-checker.js +7 -7
  518. package/src/hooks/duotone.js +4 -4
  519. package/src/hooks/grid-visualizer.js +5 -7
  520. package/src/hooks/index.js +2 -1
  521. package/src/hooks/layout-child.js +12 -3
  522. package/src/hooks/line-height.js +0 -1
  523. package/src/hooks/position.js +3 -13
  524. package/src/hooks/spacing-visualizer.js +1 -1
  525. package/src/hooks/use-bindings-attributes.js +93 -59
  526. package/src/hooks/use-editor-wrapper-styles.native.scss +1 -0
  527. package/src/hooks/use-zoom-out.js +1 -1
  528. package/src/hooks/utils.js +14 -1
  529. package/src/index.js +1 -0
  530. package/src/layouts/constrained.js +10 -2
  531. package/src/layouts/grid.js +2 -0
  532. package/src/private-apis.js +1 -8
  533. package/src/store/actions.js +28 -5
  534. package/src/store/reducer.js +18 -0
  535. package/src/store/selectors.js +14 -4
  536. package/src/style.scss +1 -1
  537. package/src/utils/get-editor-region.js +1 -1
  538. package/src/utils/get-px-from-css-unit.js +1 -1
  539. package/tsconfig.tsbuildinfo +1 -1
  540. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -30
  541. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +0 -1
  542. package/build/components/inserter/reusable-block-rename-hint.js +0 -71
  543. package/build/components/inserter/reusable-block-rename-hint.js.map +0 -1
  544. package/build/components/inspector-controls-tabs/settings-tab-hint.js +0 -53
  545. package/build/components/inspector-controls-tabs/settings-tab-hint.js.map +0 -1
  546. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -23
  547. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +0 -1
  548. package/build-module/components/inserter/reusable-block-rename-hint.js +0 -64
  549. package/build-module/components/inserter/reusable-block-rename-hint.js.map +0 -1
  550. package/build-module/components/inspector-controls-tabs/settings-tab-hint.js +0 -47
  551. package/build-module/components/inspector-controls-tabs/settings-tab-hint.js.map +0 -1
  552. package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -25
  553. package/src/components/inserter/reusable-block-rename-hint.js +0 -69
  554. package/src/components/inspector-controls-tabs/settings-tab-hint.js +0 -52
@@ -180,8 +180,7 @@ function useOnBlockDrop(targetRootClientId, targetBlockIndex, options = {}) {
180
180
  getBlockOrder,
181
181
  getBlocksByClientId,
182
182
  getSettings,
183
- getBlock,
184
- isGroupable
183
+ getBlock
185
184
  } = (0, _data.useSelect)(_store.store);
186
185
  const {
187
186
  getGroupingBlockName
@@ -201,11 +200,9 @@ function useOnBlockDrop(targetRootClientId, targetBlockIndex, options = {}) {
201
200
  }
202
201
  const clientIds = getBlockOrder(targetRootClientId);
203
202
  const clientId = clientIds[targetBlockIndex];
204
- const blocksClientIds = blocks.map(block => block.clientId);
205
- const areGroupableBlocks = isGroupable([...blocksClientIds, clientId]);
206
203
  if (operation === 'replace') {
207
204
  replaceBlocks(clientId, blocks, undefined, initialPosition);
208
- } else if (operation === 'group' && areGroupableBlocks) {
205
+ } else if (operation === 'group') {
209
206
  const targetBlock = getBlock(clientId);
210
207
  if (nearestSide === 'left') {
211
208
  blocks.push(targetBlock);
@@ -231,7 +228,7 @@ function useOnBlockDrop(targetRootClientId, targetBlockIndex, options = {}) {
231
228
  } else {
232
229
  insertBlocks(blocks, targetBlockIndex, targetRootClientId, updateSelection, initialPosition);
233
230
  }
234
- }, [getBlockOrder, targetRootClientId, targetBlockIndex, isGroupable, operation, replaceBlocks, getBlock, nearestSide, canInsertBlockType, getGroupingBlockName, insertBlocks]);
231
+ }, [getBlockOrder, targetRootClientId, targetBlockIndex, operation, replaceBlocks, getBlock, nearestSide, canInsertBlockType, getGroupingBlockName, insertBlocks]);
235
232
  const moveBlocks = (0, _element.useCallback)((sourceClientIds, sourceRootClientId, insertIndex) => {
236
233
  if (operation === 'replace') {
237
234
  const sourceBlocks = getBlocksByClientId(sourceClientIds);
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_blocks","_data","_dom","_store","parseDropEvent","event","result","srcRootClientId","srcClientIds","srcIndex","type","blocks","dataTransfer","Object","assign","JSON","parse","getData","err","onBlockDrop","targetRootClientId","targetBlockIndex","getBlockIndex","getClientIdsOfDescendants","moveBlocks","insertOrReplaceBlocks","clearSelectedBlock","operation","getBlock","sourceRootClientId","sourceClientIds","dropType","blocksToInsert","map","block","cloneBlock","sourceBlockIndex","includes","some","id","clientId","isAtSameLevel","draggedBlockCount","length","insertIndex","onFilesDrop","getSettings","updateBlockAttributes","canInsertBlockType","files","mediaUpload","transformation","findTransform","getBlockTransforms","transform","blockName","isMatch","onHTMLDrop","HTML","pasteHandler","mode","useOnBlockDrop","options","nearestSide","getBlockOrder","getBlocksByClientId","isGroupable","useSelect","blockEditorStore","getGroupingBlockName","blocksStore","insertBlocks","moveBlocksToPosition","replaceBlocks","removeBlocks","useDispatch","registry","useRegistry","useCallback","updateSelection","initialPosition","clientIdsToReplace","Array","isArray","clientIds","blocksClientIds","areGroupableBlocks","undefined","targetBlock","push","unshift","groupInnerBlocks","createBlock","name","attributes","innerBlocks","areAllImages","every","galleryBlock","wrappedBlocks","layout","flexWrap","sourceBlocks","targetBlockClientIds","targetBlockClientId","batch","_onDrop","_onFilesDrop","_onHTMLDrop","getFilesFromDataTransfer","html"],"sources":["@wordpress/block-editor/src/components/use-on-block-drop/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\nimport {\n\tcloneBlock,\n\tcreateBlock,\n\tfindTransform,\n\tgetBlockTransforms,\n\tpasteHandler,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { getFilesFromDataTransfer } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/** @typedef {import('react').SyntheticEvent} SyntheticEvent */\n/** @typedef {import('./types').WPDropOperation} WPDropOperation */\n\n/**\n * Retrieve the data for a block drop event.\n *\n * @param {SyntheticEvent} event The drop event.\n *\n * @return {Object} An object with block drag and drop data.\n */\nexport function parseDropEvent( event ) {\n\tlet result = {\n\t\tsrcRootClientId: null,\n\t\tsrcClientIds: null,\n\t\tsrcIndex: null,\n\t\ttype: null,\n\t\tblocks: null,\n\t};\n\n\tif ( ! event.dataTransfer ) {\n\t\treturn result;\n\t}\n\n\ttry {\n\t\tresult = Object.assign(\n\t\t\tresult,\n\t\t\tJSON.parse( event.dataTransfer.getData( 'wp-blocks' ) )\n\t\t);\n\t} catch ( err ) {\n\t\treturn result;\n\t}\n\n\treturn result;\n}\n\n/**\n * A function that returns an event handler function for block drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {number} targetBlockIndex The index where the block(s) will be inserted.\n * @param {Function} getBlockIndex A function that gets the index of a block.\n * @param {Function} getClientIdsOfDescendants A function that gets the client ids of descendant blocks.\n * @param {Function} moveBlocks A function that moves blocks.\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n * @param {Function} clearSelectedBlock A function that clears block selection.\n * @param {string} operation The type of operation to perform on drop. Could be `insert` or `replace` or `group`.\n * @param {Function} getBlock A function that returns a block given its client id.\n * @return {Function} The event handler for a block drop event.\n */\nexport function onBlockDrop(\n\ttargetRootClientId,\n\ttargetBlockIndex,\n\tgetBlockIndex,\n\tgetClientIdsOfDescendants,\n\tmoveBlocks,\n\tinsertOrReplaceBlocks,\n\tclearSelectedBlock,\n\toperation,\n\tgetBlock\n) {\n\treturn ( event ) => {\n\t\tconst {\n\t\t\tsrcRootClientId: sourceRootClientId,\n\t\t\tsrcClientIds: sourceClientIds,\n\t\t\ttype: dropType,\n\t\t\tblocks,\n\t\t} = parseDropEvent( event );\n\n\t\t// If the user is inserting a block.\n\t\tif ( dropType === 'inserter' ) {\n\t\t\tclearSelectedBlock();\n\t\t\tconst blocksToInsert = blocks.map( ( block ) =>\n\t\t\t\tcloneBlock( block )\n\t\t\t);\n\t\t\tinsertOrReplaceBlocks( blocksToInsert, true, null );\n\t\t}\n\n\t\t// If the user is moving a block.\n\t\tif ( dropType === 'block' ) {\n\t\t\tconst sourceBlockIndex = getBlockIndex( sourceClientIds[ 0 ] );\n\n\t\t\t// If the user is dropping to the same position, return early.\n\t\t\tif (\n\t\t\t\tsourceRootClientId === targetRootClientId &&\n\t\t\t\tsourceBlockIndex === targetBlockIndex\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If the user is attempting to drop a block within its own\n\t\t\t// nested blocks, return early as this would create infinite\n\t\t\t// recursion.\n\t\t\tif (\n\t\t\t\tsourceClientIds.includes( targetRootClientId ) ||\n\t\t\t\tgetClientIdsOfDescendants( sourceClientIds ).some(\n\t\t\t\t\t( id ) => id === targetRootClientId\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If the user is dropping a block over another block, replace both blocks\n\t\t\t// with a group block containing them\n\t\t\tif ( operation === 'group' ) {\n\t\t\t\tconst blocksToInsert = sourceClientIds.map( ( clientId ) =>\n\t\t\t\t\tgetBlock( clientId )\n\t\t\t\t);\n\t\t\t\tinsertOrReplaceBlocks(\n\t\t\t\t\tblocksToInsert,\n\t\t\t\t\ttrue,\n\t\t\t\t\tnull,\n\t\t\t\t\tsourceClientIds\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isAtSameLevel = sourceRootClientId === targetRootClientId;\n\t\t\tconst draggedBlockCount = sourceClientIds.length;\n\n\t\t\t// If the block is kept at the same level and moved downwards,\n\t\t\t// subtract to take into account that the blocks being dragged\n\t\t\t// were removed from the block list above the insertion point.\n\t\t\tconst insertIndex =\n\t\t\t\tisAtSameLevel && sourceBlockIndex < targetBlockIndex\n\t\t\t\t\t? targetBlockIndex - draggedBlockCount\n\t\t\t\t\t: targetBlockIndex;\n\n\t\t\tmoveBlocks( sourceClientIds, sourceRootClientId, insertIndex );\n\t\t}\n\t};\n}\n\n/**\n * A function that returns an event handler function for block-related file drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {Function} getSettings A function that gets the block editor settings.\n * @param {Function} updateBlockAttributes A function that updates a block's attributes.\n * @param {Function} canInsertBlockType A function that returns checks whether a block type can be inserted.\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n *\n * @return {Function} The event handler for a block-related file drop event.\n */\nexport function onFilesDrop(\n\ttargetRootClientId,\n\tgetSettings,\n\tupdateBlockAttributes,\n\tcanInsertBlockType,\n\tinsertOrReplaceBlocks\n) {\n\treturn ( files ) => {\n\t\tif ( ! getSettings().mediaUpload ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst transformation = findTransform(\n\t\t\tgetBlockTransforms( 'from' ),\n\t\t\t( transform ) =>\n\t\t\t\ttransform.type === 'files' &&\n\t\t\t\tcanInsertBlockType( transform.blockName, targetRootClientId ) &&\n\t\t\t\ttransform.isMatch( files )\n\t\t);\n\n\t\tif ( transformation ) {\n\t\t\tconst blocks = transformation.transform(\n\t\t\t\tfiles,\n\t\t\t\tupdateBlockAttributes\n\t\t\t);\n\t\t\tinsertOrReplaceBlocks( blocks );\n\t\t}\n\t};\n}\n\n/**\n * A function that returns an event handler function for block-related HTML drop events.\n *\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n *\n * @return {Function} The event handler for a block-related HTML drop event.\n */\nexport function onHTMLDrop( insertOrReplaceBlocks ) {\n\treturn ( HTML ) => {\n\t\tconst blocks = pasteHandler( { HTML, mode: 'BLOCKS' } );\n\n\t\tif ( blocks.length ) {\n\t\t\tinsertOrReplaceBlocks( blocks );\n\t\t}\n\t};\n}\n\n/**\n * A React hook for handling block drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {number} targetBlockIndex The index where the block(s) will be inserted.\n * @param {Object} options The optional options.\n * @param {WPDropOperation} [options.operation] The type of operation to perform on drop. Could be `insert` or `replace` for now.\n *\n * @return {Function} A function to be passed to the onDrop handler.\n */\nexport default function useOnBlockDrop(\n\ttargetRootClientId,\n\ttargetBlockIndex,\n\toptions = {}\n) {\n\tconst { operation = 'insert', nearestSide = 'right' } = options;\n\tconst {\n\t\tcanInsertBlockType,\n\t\tgetBlockIndex,\n\t\tgetClientIdsOfDescendants,\n\t\tgetBlockOrder,\n\t\tgetBlocksByClientId,\n\t\tgetSettings,\n\t\tgetBlock,\n\t\tisGroupable,\n\t} = useSelect( blockEditorStore );\n\tconst { getGroupingBlockName } = useSelect( blocksStore );\n\tconst {\n\t\tinsertBlocks,\n\t\tmoveBlocksToPosition,\n\t\tupdateBlockAttributes,\n\t\tclearSelectedBlock,\n\t\treplaceBlocks,\n\t\tremoveBlocks,\n\t} = useDispatch( blockEditorStore );\n\tconst registry = useRegistry();\n\n\tconst insertOrReplaceBlocks = useCallback(\n\t\t(\n\t\t\tblocks,\n\t\t\tupdateSelection = true,\n\t\t\tinitialPosition = 0,\n\t\t\tclientIdsToReplace = []\n\t\t) => {\n\t\t\tif ( ! Array.isArray( blocks ) ) {\n\t\t\t\tblocks = [ blocks ];\n\t\t\t}\n\n\t\t\tconst clientIds = getBlockOrder( targetRootClientId );\n\t\t\tconst clientId = clientIds[ targetBlockIndex ];\n\t\t\tconst blocksClientIds = blocks.map( ( block ) => block.clientId );\n\t\t\tconst areGroupableBlocks = isGroupable( [\n\t\t\t\t...blocksClientIds,\n\t\t\t\tclientId,\n\t\t\t] );\n\t\t\tif ( operation === 'replace' ) {\n\t\t\t\treplaceBlocks( clientId, blocks, undefined, initialPosition );\n\t\t\t} else if ( operation === 'group' && areGroupableBlocks ) {\n\t\t\t\tconst targetBlock = getBlock( clientId );\n\t\t\t\tif ( nearestSide === 'left' ) {\n\t\t\t\t\tblocks.push( targetBlock );\n\t\t\t\t} else {\n\t\t\t\t\tblocks.unshift( targetBlock );\n\t\t\t\t}\n\n\t\t\t\tconst groupInnerBlocks = blocks.map( ( block ) => {\n\t\t\t\t\treturn createBlock(\n\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\tblock.attributes,\n\t\t\t\t\t\tblock.innerBlocks\n\t\t\t\t\t);\n\t\t\t\t} );\n\n\t\t\t\tconst areAllImages = blocks.every( ( block ) => {\n\t\t\t\t\treturn block.name === 'core/image';\n\t\t\t\t} );\n\n\t\t\t\tconst galleryBlock = canInsertBlockType(\n\t\t\t\t\t'core/gallery',\n\t\t\t\t\ttargetRootClientId\n\t\t\t\t);\n\n\t\t\t\tconst wrappedBlocks = createBlock(\n\t\t\t\t\tareAllImages && galleryBlock\n\t\t\t\t\t\t? 'core/gallery'\n\t\t\t\t\t\t: getGroupingBlockName(),\n\t\t\t\t\t{\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\ttype: 'flex',\n\t\t\t\t\t\t\tflexWrap:\n\t\t\t\t\t\t\t\tareAllImages && galleryBlock ? null : 'nowrap',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tgroupInnerBlocks\n\t\t\t\t);\n\t\t\t\t// Need to make sure both the target block and the block being dragged are replaced\n\t\t\t\t// otherwise the dragged block will be duplicated.\n\t\t\t\treplaceBlocks(\n\t\t\t\t\t[ clientId, ...clientIdsToReplace ],\n\t\t\t\t\twrappedBlocks,\n\t\t\t\t\tundefined,\n\t\t\t\t\tinitialPosition\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tinsertBlocks(\n\t\t\t\t\tblocks,\n\t\t\t\t\ttargetBlockIndex,\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\tupdateSelection,\n\t\t\t\t\tinitialPosition\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tgetBlockOrder,\n\t\t\ttargetRootClientId,\n\t\t\ttargetBlockIndex,\n\t\t\tisGroupable,\n\t\t\toperation,\n\t\t\treplaceBlocks,\n\t\t\tgetBlock,\n\t\t\tnearestSide,\n\t\t\tcanInsertBlockType,\n\t\t\tgetGroupingBlockName,\n\t\t\tinsertBlocks,\n\t\t]\n\t);\n\n\tconst moveBlocks = useCallback(\n\t\t( sourceClientIds, sourceRootClientId, insertIndex ) => {\n\t\t\tif ( operation === 'replace' ) {\n\t\t\t\tconst sourceBlocks = getBlocksByClientId( sourceClientIds );\n\t\t\t\tconst targetBlockClientIds =\n\t\t\t\t\tgetBlockOrder( targetRootClientId );\n\t\t\t\tconst targetBlockClientId =\n\t\t\t\t\ttargetBlockClientIds[ targetBlockIndex ];\n\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t// Remove the source blocks.\n\t\t\t\t\tremoveBlocks( sourceClientIds, false );\n\t\t\t\t\t// Replace the target block with the source blocks.\n\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\ttargetBlockClientId,\n\t\t\t\t\t\tsourceBlocks,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t0\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\tsourceClientIds,\n\t\t\t\t\tsourceRootClientId,\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\tinsertIndex\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\toperation,\n\t\t\tgetBlockOrder,\n\t\t\tgetBlocksByClientId,\n\t\t\tmoveBlocksToPosition,\n\t\t\tregistry,\n\t\t\tremoveBlocks,\n\t\t\treplaceBlocks,\n\t\t\ttargetBlockIndex,\n\t\t\ttargetRootClientId,\n\t\t]\n\t);\n\n\tconst _onDrop = onBlockDrop(\n\t\ttargetRootClientId,\n\t\ttargetBlockIndex,\n\t\tgetBlockIndex,\n\t\tgetClientIdsOfDescendants,\n\t\tmoveBlocks,\n\t\tinsertOrReplaceBlocks,\n\t\tclearSelectedBlock,\n\t\toperation,\n\t\tgetBlock\n\t);\n\tconst _onFilesDrop = onFilesDrop(\n\t\ttargetRootClientId,\n\t\tgetSettings,\n\t\tupdateBlockAttributes,\n\t\tcanInsertBlockType,\n\t\tinsertOrReplaceBlocks\n\t);\n\tconst _onHTMLDrop = onHTMLDrop( insertOrReplaceBlocks );\n\n\treturn ( event ) => {\n\t\tconst files = getFilesFromDataTransfer( event.dataTransfer );\n\t\tconst html = event.dataTransfer.getData( 'text/html' );\n\n\t\t/**\n\t\t * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.\n\t\t * The order of the checks is important to recognise the HTML drop.\n\t\t */\n\t\tif ( html ) {\n\t\t\t_onHTMLDrop( html );\n\t\t} else if ( files.length ) {\n\t\t\t_onFilesDrop( files );\n\t\t} else {\n\t\t\t_onDrop( event );\n\t\t}\n\t};\n}\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAQA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAlBA;AACA;AACA;;AAaA;AACA;AACA;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,cAAcA,CAAEC,KAAK,EAAG;EACvC,IAAIC,MAAM,GAAG;IACZC,eAAe,EAAE,IAAI;IACrBC,YAAY,EAAE,IAAI;IAClBC,QAAQ,EAAE,IAAI;IACdC,IAAI,EAAE,IAAI;IACVC,MAAM,EAAE;EACT,CAAC;EAED,IAAK,CAAEN,KAAK,CAACO,YAAY,EAAG;IAC3B,OAAON,MAAM;EACd;EAEA,IAAI;IACHA,MAAM,GAAGO,MAAM,CAACC,MAAM,CACrBR,MAAM,EACNS,IAAI,CAACC,KAAK,CAAEX,KAAK,CAACO,YAAY,CAACK,OAAO,CAAE,WAAY,CAAE,CACvD,CAAC;EACF,CAAC,CAAC,OAAQC,GAAG,EAAG;IACf,OAAOZ,MAAM;EACd;EAEA,OAAOA,MAAM;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASa,W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BAAkB,EAClBvB,qBACD,CAAC;EACD,MAAMmF,WAAW,GAAGnD,UAAU,CAAEhC,qBAAsB,CAAC;EAEvD,OAASpB,KAAK,IAAM;IACnB,MAAM4C,KAAK,GAAG,IAAA4D,6BAAwB,EAAExG,KAAK,CAACO,YAAa,CAAC;IAC5D,MAAMkG,IAAI,GAAGzG,KAAK,CAACO,YAAY,CAACK,OAAO,CAAE,WAAY,CAAC;;IAEtD;AACF;AACA;AACA;IACE,IAAK6F,IAAI,EAAG;MACXF,WAAW,CAAEE,IAAK,CAAC;IACpB,CAAC,MAAM,IAAK7D,KAAK,CAACN,MAAM,EAAG;MAC1BgE,YAAY,CAAE1D,KAAM,CAAC;IACtB,CAAC,MAAM;MACNyD,OAAO,CAAErG,KAAM,CAAC;IACjB;EACD,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_blocks","_data","_dom","_store","parseDropEvent","event","result","srcRootClientId","srcClientIds","srcIndex","type","blocks","dataTransfer","Object","assign","JSON","parse","getData","err","onBlockDrop","targetRootClientId","targetBlockIndex","getBlockIndex","getClientIdsOfDescendants","moveBlocks","insertOrReplaceBlocks","clearSelectedBlock","operation","getBlock","sourceRootClientId","sourceClientIds","dropType","blocksToInsert","map","block","cloneBlock","sourceBlockIndex","includes","some","id","clientId","isAtSameLevel","draggedBlockCount","length","insertIndex","onFilesDrop","getSettings","updateBlockAttributes","canInsertBlockType","files","mediaUpload","transformation","findTransform","getBlockTransforms","transform","blockName","isMatch","onHTMLDrop","HTML","pasteHandler","mode","useOnBlockDrop","options","nearestSide","getBlockOrder","getBlocksByClientId","useSelect","blockEditorStore","getGroupingBlockName","blocksStore","insertBlocks","moveBlocksToPosition","replaceBlocks","removeBlocks","useDispatch","registry","useRegistry","useCallback","updateSelection","initialPosition","clientIdsToReplace","Array","isArray","clientIds","undefined","targetBlock","push","unshift","groupInnerBlocks","createBlock","name","attributes","innerBlocks","areAllImages","every","galleryBlock","wrappedBlocks","layout","flexWrap","sourceBlocks","targetBlockClientIds","targetBlockClientId","batch","_onDrop","_onFilesDrop","_onHTMLDrop","getFilesFromDataTransfer","html"],"sources":["@wordpress/block-editor/src/components/use-on-block-drop/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\nimport {\n\tcloneBlock,\n\tcreateBlock,\n\tfindTransform,\n\tgetBlockTransforms,\n\tpasteHandler,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { getFilesFromDataTransfer } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/** @typedef {import('react').SyntheticEvent} SyntheticEvent */\n/** @typedef {import('./types').WPDropOperation} WPDropOperation */\n\n/**\n * Retrieve the data for a block drop event.\n *\n * @param {SyntheticEvent} event The drop event.\n *\n * @return {Object} An object with block drag and drop data.\n */\nexport function parseDropEvent( event ) {\n\tlet result = {\n\t\tsrcRootClientId: null,\n\t\tsrcClientIds: null,\n\t\tsrcIndex: null,\n\t\ttype: null,\n\t\tblocks: null,\n\t};\n\n\tif ( ! event.dataTransfer ) {\n\t\treturn result;\n\t}\n\n\ttry {\n\t\tresult = Object.assign(\n\t\t\tresult,\n\t\t\tJSON.parse( event.dataTransfer.getData( 'wp-blocks' ) )\n\t\t);\n\t} catch ( err ) {\n\t\treturn result;\n\t}\n\n\treturn result;\n}\n\n/**\n * A function that returns an event handler function for block drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {number} targetBlockIndex The index where the block(s) will be inserted.\n * @param {Function} getBlockIndex A function that gets the index of a block.\n * @param {Function} getClientIdsOfDescendants A function that gets the client ids of descendant blocks.\n * @param {Function} moveBlocks A function that moves blocks.\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n * @param {Function} clearSelectedBlock A function that clears block selection.\n * @param {string} operation The type of operation to perform on drop. Could be `insert` or `replace` or `group`.\n * @param {Function} getBlock A function that returns a block given its client id.\n * @return {Function} The event handler for a block drop event.\n */\nexport function onBlockDrop(\n\ttargetRootClientId,\n\ttargetBlockIndex,\n\tgetBlockIndex,\n\tgetClientIdsOfDescendants,\n\tmoveBlocks,\n\tinsertOrReplaceBlocks,\n\tclearSelectedBlock,\n\toperation,\n\tgetBlock\n) {\n\treturn ( event ) => {\n\t\tconst {\n\t\t\tsrcRootClientId: sourceRootClientId,\n\t\t\tsrcClientIds: sourceClientIds,\n\t\t\ttype: dropType,\n\t\t\tblocks,\n\t\t} = parseDropEvent( event );\n\n\t\t// If the user is inserting a block.\n\t\tif ( dropType === 'inserter' ) {\n\t\t\tclearSelectedBlock();\n\t\t\tconst blocksToInsert = blocks.map( ( block ) =>\n\t\t\t\tcloneBlock( block )\n\t\t\t);\n\t\t\tinsertOrReplaceBlocks( blocksToInsert, true, null );\n\t\t}\n\n\t\t// If the user is moving a block.\n\t\tif ( dropType === 'block' ) {\n\t\t\tconst sourceBlockIndex = getBlockIndex( sourceClientIds[ 0 ] );\n\n\t\t\t// If the user is dropping to the same position, return early.\n\t\t\tif (\n\t\t\t\tsourceRootClientId === targetRootClientId &&\n\t\t\t\tsourceBlockIndex === targetBlockIndex\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If the user is attempting to drop a block within its own\n\t\t\t// nested blocks, return early as this would create infinite\n\t\t\t// recursion.\n\t\t\tif (\n\t\t\t\tsourceClientIds.includes( targetRootClientId ) ||\n\t\t\t\tgetClientIdsOfDescendants( sourceClientIds ).some(\n\t\t\t\t\t( id ) => id === targetRootClientId\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If the user is dropping a block over another block, replace both blocks\n\t\t\t// with a group block containing them\n\t\t\tif ( operation === 'group' ) {\n\t\t\t\tconst blocksToInsert = sourceClientIds.map( ( clientId ) =>\n\t\t\t\t\tgetBlock( clientId )\n\t\t\t\t);\n\t\t\t\tinsertOrReplaceBlocks(\n\t\t\t\t\tblocksToInsert,\n\t\t\t\t\ttrue,\n\t\t\t\t\tnull,\n\t\t\t\t\tsourceClientIds\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isAtSameLevel = sourceRootClientId === targetRootClientId;\n\t\t\tconst draggedBlockCount = sourceClientIds.length;\n\n\t\t\t// If the block is kept at the same level and moved downwards,\n\t\t\t// subtract to take into account that the blocks being dragged\n\t\t\t// were removed from the block list above the insertion point.\n\t\t\tconst insertIndex =\n\t\t\t\tisAtSameLevel && sourceBlockIndex < targetBlockIndex\n\t\t\t\t\t? targetBlockIndex - draggedBlockCount\n\t\t\t\t\t: targetBlockIndex;\n\n\t\t\tmoveBlocks( sourceClientIds, sourceRootClientId, insertIndex );\n\t\t}\n\t};\n}\n\n/**\n * A function that returns an event handler function for block-related file drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {Function} getSettings A function that gets the block editor settings.\n * @param {Function} updateBlockAttributes A function that updates a block's attributes.\n * @param {Function} canInsertBlockType A function that returns checks whether a block type can be inserted.\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n *\n * @return {Function} The event handler for a block-related file drop event.\n */\nexport function onFilesDrop(\n\ttargetRootClientId,\n\tgetSettings,\n\tupdateBlockAttributes,\n\tcanInsertBlockType,\n\tinsertOrReplaceBlocks\n) {\n\treturn ( files ) => {\n\t\tif ( ! getSettings().mediaUpload ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst transformation = findTransform(\n\t\t\tgetBlockTransforms( 'from' ),\n\t\t\t( transform ) =>\n\t\t\t\ttransform.type === 'files' &&\n\t\t\t\tcanInsertBlockType( transform.blockName, targetRootClientId ) &&\n\t\t\t\ttransform.isMatch( files )\n\t\t);\n\n\t\tif ( transformation ) {\n\t\t\tconst blocks = transformation.transform(\n\t\t\t\tfiles,\n\t\t\t\tupdateBlockAttributes\n\t\t\t);\n\t\t\tinsertOrReplaceBlocks( blocks );\n\t\t}\n\t};\n}\n\n/**\n * A function that returns an event handler function for block-related HTML drop events.\n *\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n *\n * @return {Function} The event handler for a block-related HTML drop event.\n */\nexport function onHTMLDrop( insertOrReplaceBlocks ) {\n\treturn ( HTML ) => {\n\t\tconst blocks = pasteHandler( { HTML, mode: 'BLOCKS' } );\n\n\t\tif ( blocks.length ) {\n\t\t\tinsertOrReplaceBlocks( blocks );\n\t\t}\n\t};\n}\n\n/**\n * A React hook for handling block drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {number} targetBlockIndex The index where the block(s) will be inserted.\n * @param {Object} options The optional options.\n * @param {WPDropOperation} [options.operation] The type of operation to perform on drop. Could be `insert` or `replace` for now.\n *\n * @return {Function} A function to be passed to the onDrop handler.\n */\nexport default function useOnBlockDrop(\n\ttargetRootClientId,\n\ttargetBlockIndex,\n\toptions = {}\n) {\n\tconst { operation = 'insert', nearestSide = 'right' } = options;\n\tconst {\n\t\tcanInsertBlockType,\n\t\tgetBlockIndex,\n\t\tgetClientIdsOfDescendants,\n\t\tgetBlockOrder,\n\t\tgetBlocksByClientId,\n\t\tgetSettings,\n\t\tgetBlock,\n\t} = useSelect( blockEditorStore );\n\tconst { getGroupingBlockName } = useSelect( blocksStore );\n\tconst {\n\t\tinsertBlocks,\n\t\tmoveBlocksToPosition,\n\t\tupdateBlockAttributes,\n\t\tclearSelectedBlock,\n\t\treplaceBlocks,\n\t\tremoveBlocks,\n\t} = useDispatch( blockEditorStore );\n\tconst registry = useRegistry();\n\n\tconst insertOrReplaceBlocks = useCallback(\n\t\t(\n\t\t\tblocks,\n\t\t\tupdateSelection = true,\n\t\t\tinitialPosition = 0,\n\t\t\tclientIdsToReplace = []\n\t\t) => {\n\t\t\tif ( ! Array.isArray( blocks ) ) {\n\t\t\t\tblocks = [ blocks ];\n\t\t\t}\n\t\t\tconst clientIds = getBlockOrder( targetRootClientId );\n\t\t\tconst clientId = clientIds[ targetBlockIndex ];\n\t\t\tif ( operation === 'replace' ) {\n\t\t\t\treplaceBlocks( clientId, blocks, undefined, initialPosition );\n\t\t\t} else if ( operation === 'group' ) {\n\t\t\t\tconst targetBlock = getBlock( clientId );\n\t\t\t\tif ( nearestSide === 'left' ) {\n\t\t\t\t\tblocks.push( targetBlock );\n\t\t\t\t} else {\n\t\t\t\t\tblocks.unshift( targetBlock );\n\t\t\t\t}\n\n\t\t\t\tconst groupInnerBlocks = blocks.map( ( block ) => {\n\t\t\t\t\treturn createBlock(\n\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\tblock.attributes,\n\t\t\t\t\t\tblock.innerBlocks\n\t\t\t\t\t);\n\t\t\t\t} );\n\n\t\t\t\tconst areAllImages = blocks.every( ( block ) => {\n\t\t\t\t\treturn block.name === 'core/image';\n\t\t\t\t} );\n\n\t\t\t\tconst galleryBlock = canInsertBlockType(\n\t\t\t\t\t'core/gallery',\n\t\t\t\t\ttargetRootClientId\n\t\t\t\t);\n\n\t\t\t\tconst wrappedBlocks = createBlock(\n\t\t\t\t\tareAllImages && galleryBlock\n\t\t\t\t\t\t? 'core/gallery'\n\t\t\t\t\t\t: getGroupingBlockName(),\n\t\t\t\t\t{\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\ttype: 'flex',\n\t\t\t\t\t\t\tflexWrap:\n\t\t\t\t\t\t\t\tareAllImages && galleryBlock ? null : 'nowrap',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tgroupInnerBlocks\n\t\t\t\t);\n\t\t\t\t// Need to make sure both the target block and the block being dragged are replaced\n\t\t\t\t// otherwise the dragged block will be duplicated.\n\t\t\t\treplaceBlocks(\n\t\t\t\t\t[ clientId, ...clientIdsToReplace ],\n\t\t\t\t\twrappedBlocks,\n\t\t\t\t\tundefined,\n\t\t\t\t\tinitialPosition\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tinsertBlocks(\n\t\t\t\t\tblocks,\n\t\t\t\t\ttargetBlockIndex,\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\tupdateSelection,\n\t\t\t\t\tinitialPosition\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tgetBlockOrder,\n\t\t\ttargetRootClientId,\n\t\t\ttargetBlockIndex,\n\t\t\toperation,\n\t\t\treplaceBlocks,\n\t\t\tgetBlock,\n\t\t\tnearestSide,\n\t\t\tcanInsertBlockType,\n\t\t\tgetGroupingBlockName,\n\t\t\tinsertBlocks,\n\t\t]\n\t);\n\n\tconst moveBlocks = useCallback(\n\t\t( sourceClientIds, sourceRootClientId, insertIndex ) => {\n\t\t\tif ( operation === 'replace' ) {\n\t\t\t\tconst sourceBlocks = getBlocksByClientId( sourceClientIds );\n\t\t\t\tconst targetBlockClientIds =\n\t\t\t\t\tgetBlockOrder( targetRootClientId );\n\t\t\t\tconst targetBlockClientId =\n\t\t\t\t\ttargetBlockClientIds[ targetBlockIndex ];\n\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t// Remove the source blocks.\n\t\t\t\t\tremoveBlocks( sourceClientIds, false );\n\t\t\t\t\t// Replace the target block with the source blocks.\n\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\ttargetBlockClientId,\n\t\t\t\t\t\tsourceBlocks,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t0\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\tsourceClientIds,\n\t\t\t\t\tsourceRootClientId,\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\tinsertIndex\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\toperation,\n\t\t\tgetBlockOrder,\n\t\t\tgetBlocksByClientId,\n\t\t\tmoveBlocksToPosition,\n\t\t\tregistry,\n\t\t\tremoveBlocks,\n\t\t\treplaceBlocks,\n\t\t\ttargetBlockIndex,\n\t\t\ttargetRootClientId,\n\t\t]\n\t);\n\n\tconst _onDrop = onBlockDrop(\n\t\ttargetRootClientId,\n\t\ttargetBlockIndex,\n\t\tgetBlockIndex,\n\t\tgetClientIdsOfDescendants,\n\t\tmoveBlocks,\n\t\tinsertOrReplaceBlocks,\n\t\tclearSelectedBlock,\n\t\toperation,\n\t\tgetBlock\n\t);\n\tconst _onFilesDrop = onFilesDrop(\n\t\ttargetRootClientId,\n\t\tgetSettings,\n\t\tupdateBlockAttributes,\n\t\tcanInsertBlockType,\n\t\tinsertOrReplaceBlocks\n\t);\n\tconst _onHTMLDrop = onHTMLDrop( insertOrReplaceBlocks );\n\n\treturn ( event ) => {\n\t\tconst files = getFilesFromDataTransfer( event.dataTransfer );\n\t\tconst html = event.dataTransfer.getData( 'text/html' );\n\n\t\t/**\n\t\t * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.\n\t\t * The order of the checks is important to recognise the HTML drop.\n\t\t */\n\t\tif ( html ) {\n\t\t\t_onHTMLDrop( html );\n\t\t} else if ( files.length ) {\n\t\t\t_onFilesDrop( files );\n\t\t} else {\n\t\t\t_onDrop( event );\n\t\t}\n\t};\n}\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAQA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAlBA;AACA;AACA;;AAaA;AACA;AACA;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,cAAcA,CAAEC,KAAK,EAAG;EACvC,IAAIC,MAAM,GAAG;IACZC,eAAe,EAAE,IAAI;IACrBC,YAAY,EAAE,IAAI;IAClBC,QAAQ,EAAE,IAAI;IACdC,IAAI,EAAE,IAAI;IACVC,MAAM,EAAE;EACT,CAAC;EAED,IAAK,CAAEN,KAAK,CAACO,YAAY,EAAG;IAC3B,OAAON,MAAM;EACd;EAEA,IAAI;IACHA,M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Y,GAAG3D,WAAW,CAC/BzB,kBAAkB,EAClB0B,WAAW,EACXC,qBAAqB,EACrBC,kBAAkB,EAClBvB,qBACD,CAAC;EACD,MAAMgF,WAAW,GAAGhD,UAAU,CAAEhC,qBAAsB,CAAC;EAEvD,OAASpB,KAAK,IAAM;IACnB,MAAM4C,KAAK,GAAG,IAAAyD,6BAAwB,EAAErG,KAAK,CAACO,YAAa,CAAC;IAC5D,MAAM+F,IAAI,GAAGtG,KAAK,CAACO,YAAY,CAACK,OAAO,CAAE,WAAY,CAAC;;IAEtD;AACF;AACA;AACA;IACE,IAAK0F,IAAI,EAAG;MACXF,WAAW,CAAEE,IAAK,CAAC;IACpB,CAAC,MAAM,IAAK1D,KAAK,CAACN,MAAM,EAAG;MAC1B6D,YAAY,CAAEvD,KAAM,CAAC;IACtB,CAAC,MAAM;MACNsD,OAAO,CAAElG,KAAM,CAAC;IACjB;EACD,CAAC;AACF","ignoreList":[]}
@@ -42,7 +42,7 @@ function useResizeCanvas(deviceType) {
42
42
  }
43
43
  return deviceWidth < actualWidth ? deviceWidth : actualWidth;
44
44
  };
45
- const marginValue = () => window.innerHeight < 800 ? 36 : 72;
45
+ const marginValue = () => window.innerHeight < 800 ? 36 : 64;
46
46
  const contentInlineStyles = device => {
47
47
  const height = device === 'Mobile' ? '768px' : '1024px';
48
48
  const marginVertical = marginValue() + 'px';
@@ -59,8 +59,6 @@ function useResizeCanvas(deviceType) {
59
59
  marginLeft: marginHorizontal,
60
60
  marginRight: marginHorizontal,
61
61
  height,
62
- borderRadius: '2px 2px 2px 2px',
63
- border: '1px solid #ddd',
64
62
  overflowY: 'auto'
65
63
  };
66
64
  default:
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","useResizeCanvas","deviceType","actualWidth","updateActualWidth","useState","window","innerWidth","useEffect","resizeListener","addEventListener","removeEventListener","getCanvasWidth","device","deviceWidth","marginValue","innerHeight","contentInlineStyles","height","marginVertical","marginHorizontal","width","marginTop","marginBottom","marginLeft","marginRight","borderRadius","border","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 : 72 );\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\tborderRadius: '2px 2px 2px 2px',\n\t\t\t\t\tborder: '1px solid #ddd',\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":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,eAAeA,CAAEC,UAAU,EAAG;EACrD,MAAM,CAAEC,WAAW,EAAEC,iBAAiB,CAAE,GAAG,IAAAC,iBAAQ,EAAEC,MAAM,CAACC,UAAW,CAAC;EAExE,IAAAC,kBAAS,EAAE,MAAM;IAChB,IAAKN,UAAU,KAAK,SAAS,EAAG;MAC/B;IACD;IAEA,MAAMO,cAAc,GAAGA,CAAA,KAAML,iBAAiB,CAAEE,MAAM,CAACC,UAAW,CAAC;IACnED,MAAM,CAACI,gBAAgB,CAAE,QAAQ,EAAED,cAAe,CAAC;IAEnD,OAAO,MAAM;MACZH,MAAM,CAACK,mBAAmB,CAAE,QAAQ,EAAEF,cAAe,CAAC;IACvD,CAAC;EACF,CAAC,EAAE,CAAEP,UAAU,CAAG,CAAC;EAEnB,MAAMU,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,GAAGX,WAAW,GAAGW,WAAW,GAAGX,WAAW;EAC7D,CAAC;EAED,MAAMY,WAAW,GAAGA,CAAA,KAAQT,MAAM,CAACU,WAAW,GAAG,GAAG,GAAG,EAAE,GAAG,EAAI;EAEhE,MAAMC,mBAAmB,GAAKJ,MAAM,IAAM;IACzC,MAAMK,MAAM,GAAGL,MAAM,KAAK,QAAQ,GAAG,OAAO,GAAG,QAAQ;IACvD,MAAMM,cAAc,GAAGJ,WAAW,CAAC,CAAC,GAAG,IAAI;IAC3C,MAAMK,gBAAgB,GAAG,MAAM;IAE/B,QAASP,MAAM;MACd,KAAK,QAAQ;MACb,KAAK,QAAQ;QACZ,OAAO;UACNQ,KAAK,EAAET,cAAc,CAAEC,MAAO,CAAC;UAC/B;UACA;UACAS,SAAS,EAAEH,cAAc;UACzBI,YAAY,EAAEJ,cAAc;UAC5BK,UAAU,EAAEJ,gBAAgB;UAC5BK,WAAW,EAAEL,gBAAgB;UAC7BF,MAAM;UACNQ,YAAY,EAAE,iBAAiB;UAC/BC,MAAM,EAAE,gBAAgB;UACxBC,SAAS,EAAE;QACZ,CAAC;MACF;QACC,OAAO;UACNJ,UAAU,EAAEJ,gBAAgB;UAC5BK,WAAW,EAAEL;QACd,CAAC;IACH;EACD,CAAC;EAED,OAAOH,mBAAmB,CAAEf,UAAW,CAAC;AACzC","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","useResizeCanvas","deviceType","actualWidth","updateActualWidth","useState","window","innerWidth","useEffect","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":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA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BI,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,CAAEf,UAAW,CAAC;AACzC","ignoreList":[]}
@@ -47,9 +47,10 @@ function useSettings(...paths) {
47
47
  * It looks up the setting first in the block instance hierarchy.
48
48
  * If none is found, it'll look it up in the block editor settings.
49
49
  *
50
+ * @deprecated 6.5.0 Use useSettings instead.
51
+ *
50
52
  * @param {string} path The path to the setting.
51
53
  * @return {any} Returns the value defined for the setting.
52
- * @deprecated 6.5.0 Use useSettings instead.
53
54
  * @example
54
55
  * ```js
55
56
  * const isEnabled = useSetting( 'typography.dropCap' );
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_deprecated","_interopRequireDefault","_blockEdit","_store","_lockUnlock","useSettings","paths","clientId","useBlockEditContext","useSelect","select","unlock","blockEditorStore","getBlockSettings","useSetting","path","deprecated","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 * @param {string} path The path to the setting.\n * @return {any} Returns the value defined for the setting.\n * @deprecated 6.5.0 Use useSettings instead.\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":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAXA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASM,WAAWA,CAAE,GAAGC,KAAK,EAAG;EACvC,MAAM;IAAEC,QAAQ,GAAG;EAAK,CAAC,GAAG,IAAAC,8BAAmB,EAAC,CAAC;EACjD,OAAO,IAAAC,eAAS,EACbC,MAAM,IACP,IAAAC,kBAAM,EAAED,MAAM,CAAEE,YAAiB,CAAE,CAAC,CAACC,gBAAgB,CACpDN,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;AACO,SAASQ,UAAUA,CAAEC,IAAI,EAAG;EAClC,IAAAC,mBAAU,EAAE,2BAA2B,EAAE;IACxCC,KAAK,EAAE,KAAK;IACZC,WAAW,EAAE,4BAA4B;IACzCC,IAAI,EAAE;EACP,CAAE,CAAC;EAEH,MAAM,CAAEC,KAAK,CAAE,GAAGf,WAAW,CAAEU,IAAK,CAAC;EACrC,OAAOK,KAAK;AACb","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_deprecated","_interopRequireDefault","_blockEdit","_store","_lockUnlock","useSettings","paths","clientId","useBlockEditContext","useSelect","select","unlock","blockEditorStore","getBlockSettings","useSetting","path","deprecated","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":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAXA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASM,WAAWA,CAAE,GAAGC,KAAK,EAAG;EACvC,MAAM;IAAEC,QAAQ,GAAG;EAAK,CAAC,GAAG,IAAAC,8BAAmB,EAAC,CAAC;EACjD,OAAO,IAAAC,eAAS,EACbC,MAAM,IACP,IAAAC,kBAAM,EAAED,MAAM,CAAEE,YAAiB,CAAE,CAAC,CAACC,gBAAgB,CACpDN,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;AACO,SAASQ,UAAUA,CAAEC,IAAI,EAAG;EAClC,IAAAC,mBAAU,EAAE,2BAA2B,EAAE;IACxCC,KAAK,EAAE,KAAK;IACZC,WAAW,EAAE,4BAA4B;IACzCC,IAAI,EAAE;EACP,CAAE,CAAC;EAEH,MAAM,CAAEC,KAAK,CAAE,GAAGf,WAAW,CAAEU,IAAK,CAAC;EACrC,OAAOK,KAAK;AACb","ignoreList":[]}
@@ -9,9 +9,13 @@ var _i18n = require("@wordpress/i18n");
9
9
  var _blocks = require("@wordpress/blocks");
10
10
  var _components = require("@wordpress/components");
11
11
  var _data = require("@wordpress/data");
12
+ var _element = require("@wordpress/element");
13
+ var _compose = require("@wordpress/compose");
12
14
  var _useBindingsAttributes = require("../hooks/use-bindings-attributes");
15
+ var _store = require("../store");
13
16
  var _lockUnlock = require("../lock-unlock");
14
17
  var _inspectorControls = _interopRequireDefault(require("../components/inspector-controls"));
18
+ var _blockContext = _interopRequireDefault(require("../components/block-context"));
15
19
  var _jsxRuntime = require("react/jsx-runtime");
16
20
  /**
17
21
  * WordPress dependencies
@@ -21,63 +25,271 @@ var _jsxRuntime = require("react/jsx-runtime");
21
25
  * Internal dependencies
22
26
  */
23
27
 
28
+ const {
29
+ DropdownMenuV2: DropdownMenu,
30
+ DropdownMenuGroupV2: DropdownMenuGroup,
31
+ DropdownMenuRadioItemV2: DropdownMenuRadioItem,
32
+ DropdownMenuItemLabelV2: DropdownMenuItemLabel,
33
+ DropdownMenuItemHelpTextV2: DropdownMenuItemHelpText,
34
+ DropdownMenuSeparatorV2: DropdownMenuSeparator
35
+ } = (0, _lockUnlock.unlock)(_components.privateApis);
36
+ const useToolsPanelDropdownMenuProps = () => {
37
+ const isMobile = (0, _compose.useViewportMatch)('medium', '<');
38
+ return !isMobile ? {
39
+ popoverProps: {
40
+ placement: 'left-start',
41
+ // For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)
42
+ offset: 259
43
+ }
44
+ } : {};
45
+ };
46
+ function BlockBindingsPanelDropdown({
47
+ fieldsList,
48
+ addConnection,
49
+ attribute,
50
+ binding
51
+ }) {
52
+ const currentKey = binding?.args?.key;
53
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
54
+ children: Object.entries(fieldsList).map(([label, fields], i) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_element.Fragment, {
55
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(DropdownMenuGroup, {
56
+ children: [Object.keys(fieldsList).length > 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalText, {
57
+ className: "block-editor-bindings__source-label",
58
+ upperCase: true,
59
+ variant: "muted",
60
+ "aria-hidden": true,
61
+ children: label
62
+ }), Object.entries(fields).map(([key, value]) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(DropdownMenuRadioItem, {
63
+ onChange: () => addConnection(key, attribute),
64
+ name: attribute + '-binding',
65
+ value: key,
66
+ checked: key === currentKey,
67
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(DropdownMenuItemLabel, {
68
+ children: key
69
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(DropdownMenuItemHelpText, {
70
+ children: value
71
+ })]
72
+ }, key))]
73
+ }), i !== Object.keys(fieldsList).length - 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(DropdownMenuSeparator, {})]
74
+ }, label))
75
+ });
76
+ }
77
+ function BlockBindingsAttribute({
78
+ attribute,
79
+ binding
80
+ }) {
81
+ const {
82
+ source: sourceName,
83
+ args
84
+ } = binding || {};
85
+ const sourceProps = (0, _lockUnlock.unlock)(_blocks.privateApis).getBlockBindingsSource(sourceName);
86
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
87
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalTruncate, {
88
+ children: attribute
89
+ }), !!binding && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalText, {
90
+ variant: "muted",
91
+ className: "block-editor-bindings__item-explanation",
92
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalTruncate, {
93
+ children: args?.key || sourceProps?.label || sourceName
94
+ })
95
+ })]
96
+ });
97
+ }
98
+ function ReadOnlyBlockBindingsPanelItems({
99
+ bindings
100
+ }) {
101
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
102
+ children: Object.entries(bindings).map(([attribute, binding]) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalItem, {
103
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(BlockBindingsAttribute, {
104
+ attribute: attribute,
105
+ binding: binding
106
+ })
107
+ }, attribute))
108
+ });
109
+ }
110
+ function EditableBlockBindingsPanelItems({
111
+ attributes,
112
+ bindings,
113
+ fieldsList,
114
+ addConnection,
115
+ removeConnection
116
+ }) {
117
+ const isMobile = (0, _compose.useViewportMatch)('medium', '<');
118
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
119
+ children: attributes.map(attribute => {
120
+ const binding = bindings[attribute];
121
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
122
+ hasValue: () => !!binding,
123
+ label: attribute,
124
+ onDeselect: () => {
125
+ removeConnection(attribute);
126
+ },
127
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(DropdownMenu, {
128
+ placement: isMobile ? 'bottom-start' : 'left-start',
129
+ gutter: isMobile ? 8 : 36,
130
+ className: "block-editor-bindings__popover",
131
+ trigger: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalItem, {
132
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(BlockBindingsAttribute, {
133
+ attribute: attribute,
134
+ binding: binding
135
+ })
136
+ }),
137
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(BlockBindingsPanelDropdown, {
138
+ fieldsList: fieldsList,
139
+ addConnection: addConnection,
140
+ attribute: attribute,
141
+ binding: binding
142
+ })
143
+ })
144
+ }, attribute);
145
+ })
146
+ });
147
+ }
24
148
  const BlockBindingsPanel = ({
25
149
  name,
26
150
  metadata
27
151
  }) => {
152
+ const registry = (0, _data.useRegistry)();
153
+ const blockContext = (0, _element.useContext)(_blockContext.default);
28
154
  const {
29
155
  bindings
30
156
  } = metadata || {};
157
+ const bindableAttributes = (0, _useBindingsAttributes.getBindableAttributes)(name);
158
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
159
+ const filteredBindings = {
160
+ ...bindings
161
+ };
162
+ Object.keys(filteredBindings).forEach(key => {
163
+ if (!(0, _useBindingsAttributes.canBindAttribute)(name, key) || filteredBindings[key].source === 'core/pattern-overrides') {
164
+ delete filteredBindings[key];
165
+ }
166
+ });
31
167
  const {
32
- sources
168
+ updateBlockAttributes
169
+ } = (0, _data.useDispatch)(_store.store);
170
+ const {
171
+ _id
33
172
  } = (0, _data.useSelect)(select => {
34
- const _sources = (0, _lockUnlock.unlock)(select(_blocks.store)).getAllBlockBindingsSources();
173
+ const {
174
+ getSelectedBlockClientId
175
+ } = select(_store.store);
35
176
  return {
36
- sources: _sources
177
+ _id: getSelectedBlockClientId()
37
178
  };
38
179
  }, []);
39
- if (!bindings) {
180
+ if (!bindableAttributes || bindableAttributes.length === 0) {
40
181
  return null;
41
182
  }
42
-
43
- // Don't show not allowed attributes.
44
- // Don't show the bindings connected to pattern overrides in the inspectors panel.
45
- // TODO: Explore if this should be abstracted to let other sources decide.
46
- const filteredBindings = {
47
- ...bindings
183
+ const removeAllConnections = () => {
184
+ const newMetadata = {
185
+ ...metadata
186
+ };
187
+ delete newMetadata.bindings;
188
+ updateBlockAttributes(_id, {
189
+ metadata: Object.keys(newMetadata).length === 0 ? undefined : newMetadata
190
+ });
48
191
  };
49
- Object.keys(filteredBindings).forEach(key => {
50
- if (!(0, _useBindingsAttributes.canBindAttribute)(name, key) || filteredBindings[key].source === 'core/pattern-overrides') {
51
- delete filteredBindings[key];
192
+ const addConnection = (value, attribute) => {
193
+ // Assuming the block expects a flat structure for its metadata attribute
194
+ const newMetadata = {
195
+ ...metadata,
196
+ // Adjust this according to the actual structure expected by your block
197
+ bindings: {
198
+ ...metadata?.bindings,
199
+ [attribute]: {
200
+ source: 'core/post-meta',
201
+ args: {
202
+ key: value
203
+ }
204
+ }
205
+ }
206
+ };
207
+ // Update the block's attributes with the new metadata
208
+ updateBlockAttributes(_id, {
209
+ metadata: newMetadata
210
+ });
211
+ };
212
+ const removeConnection = key => {
213
+ const newMetadata = {
214
+ ...metadata
215
+ };
216
+ if (!newMetadata.bindings) {
217
+ return;
218
+ }
219
+ delete newMetadata.bindings[key];
220
+ if (Object.keys(newMetadata.bindings).length === 0) {
221
+ delete newMetadata.bindings;
222
+ }
223
+ updateBlockAttributes(_id, {
224
+ metadata: Object.keys(newMetadata).length === 0 ? undefined : newMetadata
225
+ });
226
+ };
227
+ const fieldsList = {};
228
+ const {
229
+ getBlockBindingsSources
230
+ } = (0, _lockUnlock.unlock)(_blocks.privateApis);
231
+ const registeredSources = getBlockBindingsSources();
232
+ Object.values(registeredSources).forEach(({
233
+ getFieldsList,
234
+ label,
235
+ usesContext
236
+ }) => {
237
+ if (getFieldsList) {
238
+ // Populate context.
239
+ const context = {};
240
+ if (usesContext?.length) {
241
+ for (const key of usesContext) {
242
+ context[key] = blockContext[key];
243
+ }
244
+ }
245
+ const sourceList = getFieldsList({
246
+ registry,
247
+ context
248
+ });
249
+ // Only add source if the list is not empty.
250
+ if (sourceList) {
251
+ fieldsList[label] = {
252
+ ...sourceList
253
+ };
254
+ }
52
255
  }
53
256
  });
54
- if (Object.keys(filteredBindings).length === 0) {
257
+ // Remove empty sources.
258
+ Object.entries(fieldsList).forEach(([key, value]) => {
259
+ if (!Object.keys(value).length) {
260
+ delete fieldsList[key];
261
+ }
262
+ });
263
+
264
+ // Lock the UI when the experiment is not enabled or there are no fields to connect to.
265
+ const readOnly = !window.__experimentalBlockBindingsUI || !Object.keys(fieldsList).length;
266
+ if (readOnly && Object.keys(filteredBindings).length === 0) {
55
267
  return null;
56
268
  }
57
269
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_inspectorControls.default, {
58
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.PanelBody, {
59
- title: (0, _i18n.__)('Attributes'),
60
- className: "components-panel__block-bindings-panel",
61
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.BaseControl, {
62
- help: (0, _i18n.__)('Attributes connected to various sources.'),
63
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalItemGroup, {
64
- isBordered: true,
65
- isSeparated: true,
66
- size: "large",
67
- children: Object.keys(filteredBindings).map(key => {
68
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalItem, {
69
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
70
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
71
- children: key
72
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
73
- className: "components-item__block-bindings-source",
74
- children: sources[filteredBindings[key].source] ? sources[filteredBindings[key].source].label : filteredBindings[key].source
75
- })]
76
- })
77
- }, key);
78
- })
270
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalToolsPanel, {
271
+ label: (0, _i18n.__)('Attributes'),
272
+ resetAll: () => {
273
+ removeAllConnections();
274
+ },
275
+ dropdownMenuProps: dropdownMenuProps,
276
+ className: "block-editor-bindings__panel",
277
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalItemGroup, {
278
+ isBordered: true,
279
+ isSeparated: true,
280
+ children: readOnly ? /*#__PURE__*/(0, _jsxRuntime.jsx)(ReadOnlyBlockBindingsPanelItems, {
281
+ bindings: filteredBindings
282
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(EditableBlockBindingsPanelItems, {
283
+ attributes: bindableAttributes,
284
+ bindings: filteredBindings,
285
+ fieldsList: fieldsList,
286
+ addConnection: addConnection,
287
+ removeConnection: removeConnection
79
288
  })
80
- })
289
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalText, {
290
+ variant: "muted",
291
+ children: (0, _i18n.__)('Attributes connected to various sources.')
292
+ })]
81
293
  })
82
294
  });
83
295
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_blocks","_components","_data","_useBindingsAttributes","_lockUnlock","_inspectorControls","_interopRequireDefault","_jsxRuntime","BlockBindingsPanel","name","metadata","bindings","sources","useSelect","select","_sources","unlock","blocksStore","getAllBlockBindingsSources","filteredBindings","Object","keys","forEach","key","canBindAttribute","source","length","jsx","default","children","PanelBody","title","__","className","BaseControl","help","__experimentalItemGroup","isBordered","isSeparated","size","map","__experimentalItem","jsxs","__experimentalHStack","label","exports","_default","edit","attributeKeys","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/block-bindings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tBaseControl,\n\tPanelBody,\n\t__experimentalHStack as HStack,\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { canBindAttribute } from '../hooks/use-bindings-attributes';\nimport { unlock } from '../lock-unlock';\nimport InspectorControls from '../components/inspector-controls';\n\nexport const BlockBindingsPanel = ( { name, metadata } ) => {\n\tconst { bindings } = metadata || {};\n\tconst { sources } = useSelect( ( select ) => {\n\t\tconst _sources = unlock(\n\t\t\tselect( blocksStore )\n\t\t).getAllBlockBindingsSources();\n\n\t\treturn {\n\t\t\tsources: _sources,\n\t\t};\n\t}, [] );\n\n\tif ( ! bindings ) {\n\t\treturn null;\n\t}\n\n\t// Don't show not allowed attributes.\n\t// Don't show the bindings connected to pattern overrides in the inspectors panel.\n\t// TODO: Explore if this should be abstracted to let other sources decide.\n\tconst filteredBindings = { ...bindings };\n\tObject.keys( filteredBindings ).forEach( ( key ) => {\n\t\tif (\n\t\t\t! canBindAttribute( name, key ) ||\n\t\t\tfilteredBindings[ key ].source === 'core/pattern-overrides'\n\t\t) {\n\t\t\tdelete filteredBindings[ key ];\n\t\t}\n\t} );\n\n\tif ( Object.keys( filteredBindings ).length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorControls>\n\t\t\t<PanelBody\n\t\t\t\ttitle={ __( 'Attributes' ) }\n\t\t\t\tclassName=\"components-panel__block-bindings-panel\"\n\t\t\t>\n\t\t\t\t<BaseControl\n\t\t\t\t\thelp={ __( 'Attributes connected to various sources.' ) }\n\t\t\t\t>\n\t\t\t\t\t<ItemGroup isBordered isSeparated size=\"large\">\n\t\t\t\t\t\t{ Object.keys( filteredBindings ).map( ( key ) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<Item key={ key }>\n\t\t\t\t\t\t\t\t\t<HStack>\n\t\t\t\t\t\t\t\t\t\t<span>{ key }</span>\n\t\t\t\t\t\t\t\t\t\t<span className=\"components-item__block-bindings-source\">\n\t\t\t\t\t\t\t\t\t\t\t{ sources[\n\t\t\t\t\t\t\t\t\t\t\t\tfilteredBindings[ key ].source\n\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t\t? sources[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfilteredBindings[ key ]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.source\n\t\t\t\t\t\t\t\t\t\t\t\t ].label\n\t\t\t\t\t\t\t\t\t\t\t\t: filteredBindings[ key ]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.source }\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t</ItemGroup>\n\t\t\t\t</BaseControl>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n};\n\nexport default {\n\tedit: BlockBindingsPanel,\n\tattributeKeys: [ 'metadata' ],\n\thasSupport() {\n\t\treturn true;\n\t},\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,O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xBwC,aAAa,EAAE,CAAE,UAAU,CAAE;EAC7BC,UAAUA,CAAA,EAAG;IACZ,OAAO,IAAI;EACZ;AACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_blocks","_components","_data","_element","_compose","_useBindingsAttributes","_store","_lockUnlock","_inspectorControls","_interopRequireDefault","_blockContext","_jsxRuntime","DropdownMenuV2","DropdownMenu","DropdownMenuGroupV2","DropdownMenuGroup","DropdownMenuRadioItemV2","DropdownMenuRadioItem","DropdownMenuItemLabelV2","DropdownMenuItemLabel","DropdownMenuItemHelpTextV2","DropdownMenuItemHelpText","DropdownMenuSeparatorV2","DropdownMenuSeparator","unlock","componentsPrivateApis","useToolsPanelDropdownMenuProps","isMobile","useViewportMatch","popoverProps","placement","offset","BlockBindingsPanelDropdown","fieldsList","addConnection","attribute","binding","currentKey","args","key","jsx","Fragment","children","Object","entries","map","label","fields","i","jsxs","keys","length","__experimentalText","className","upperCase","variant","value","onChange","name","checked","BlockBindingsAttribute","source","sourceName","sourceProps","blocksPrivateApis","getBlockBindingsSource","__experimentalVStack","__experimentalTruncate","ReadOnlyBlockBindingsPanelItems","bindings","__experimentalItem","EditableBlockBindingsPanelItems","attributes","removeConnection","__experimentalToolsPanelItem","hasValue","onDeselect","gutter","trigger","BlockBindingsPanel","metadata","registry","useRegistry","blockContext","useContext","BlockContext","bindableAttributes","getBindableAttributes","dropdownMenuProps","filteredBindings","forEach","canBindAttribute","updateBlockAttributes","useDispatch","blockEditorStore","_id","useSelect","select","getSelectedBlockClientId","removeAllConnections","newMetadata","undefined","getBlockBindingsSources","registeredSources","values","getFieldsList","usesContext","context","sourceList","readOnly","window","__experimentalBlockBindingsUI","default","__experimentalToolsPanel","__","resetAll","__experimentalItemGroup","isBordered","isSeparated","exports","_default","edit","attributeKeys","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/block-bindings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalText as Text,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalTruncate as Truncate,\n\t__experimentalVStack as VStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useSelect, useDispatch, useRegistry } from '@wordpress/data';\nimport { useContext, Fragment } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcanBindAttribute,\n\tgetBindableAttributes,\n} from '../hooks/use-bindings-attributes';\nimport { store as blockEditorStore } from '../store';\nimport { unlock } from '../lock-unlock';\nimport InspectorControls from '../components/inspector-controls';\nimport BlockContext from '../components/block-context';\n\nconst {\n\tDropdownMenuV2: DropdownMenu,\n\tDropdownMenuGroupV2: DropdownMenuGroup,\n\tDropdownMenuRadioItemV2: DropdownMenuRadioItem,\n\tDropdownMenuItemLabelV2: DropdownMenuItemLabel,\n\tDropdownMenuItemHelpTextV2: DropdownMenuItemHelpText,\n\tDropdownMenuSeparatorV2: DropdownMenuSeparator,\n} = unlock( componentsPrivateApis );\n\nconst useToolsPanelDropdownMenuProps = () => {\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn ! isMobile\n\t\t? {\n\t\t\t\tpopoverProps: {\n\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t// For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)\n\t\t\t\t\toffset: 259,\n\t\t\t\t},\n\t\t }\n\t\t: {};\n};\n\nfunction BlockBindingsPanelDropdown( {\n\tfieldsList,\n\taddConnection,\n\tattribute,\n\tbinding,\n} ) {\n\tconst currentKey = binding?.args?.key;\n\treturn (\n\t\t<>\n\t\t\t{ Object.entries( fieldsList ).map( ( [ label, fields ], i ) => (\n\t\t\t\t<Fragment key={ label }>\n\t\t\t\t\t<DropdownMenuGroup>\n\t\t\t\t\t\t{ Object.keys( fieldsList ).length > 1 && (\n\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\tclassName=\"block-editor-bindings__source-label\"\n\t\t\t\t\t\t\t\tupperCase\n\t\t\t\t\t\t\t\tvariant=\"muted\"\n\t\t\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ Object.entries( fields ).map( ( [ key, value ] ) => (\n\t\t\t\t\t\t\t<DropdownMenuRadioItem\n\t\t\t\t\t\t\t\tkey={ key }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\taddConnection( key, attribute )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tname={ attribute + '-binding' }\n\t\t\t\t\t\t\t\tvalue={ key }\n\t\t\t\t\t\t\t\tchecked={ key === currentKey }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<DropdownMenuItemLabel>\n\t\t\t\t\t\t\t\t\t{ key }\n\t\t\t\t\t\t\t\t</DropdownMenuItemLabel>\n\t\t\t\t\t\t\t\t<DropdownMenuItemHelpText>\n\t\t\t\t\t\t\t\t\t{ value }\n\t\t\t\t\t\t\t\t</DropdownMenuItemHelpText>\n\t\t\t\t\t\t\t</DropdownMenuRadioItem>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</DropdownMenuGroup>\n\t\t\t\t\t{ i !== Object.keys( fieldsList ).length - 1 && (\n\t\t\t\t\t\t<DropdownMenuSeparator />\n\t\t\t\t\t) }\n\t\t\t\t</Fragment>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction BlockBindingsAttribute( { attribute, binding } ) {\n\tconst { source: sourceName, args } = binding || {};\n\tconst sourceProps =\n\t\tunlock( blocksPrivateApis ).getBlockBindingsSource( sourceName );\n\treturn (\n\t\t<VStack>\n\t\t\t<Truncate>{ attribute }</Truncate>\n\t\t\t{ !! binding && (\n\t\t\t\t<Text\n\t\t\t\t\tvariant=\"muted\"\n\t\t\t\t\tclassName=\"block-editor-bindings__item-explanation\"\n\t\t\t\t>\n\t\t\t\t\t<Truncate>\n\t\t\t\t\t\t{ args?.key || sourceProps?.label || sourceName }\n\t\t\t\t\t</Truncate>\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nfunction ReadOnlyBlockBindingsPanelItems( { bindings } ) {\n\treturn (\n\t\t<>\n\t\t\t{ Object.entries( bindings ).map( ( [ attribute, binding ] ) => (\n\t\t\t\t<Item key={ attribute }>\n\t\t\t\t\t<BlockBindingsAttribute\n\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t/>\n\t\t\t\t</Item>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction EditableBlockBindingsPanelItems( {\n\tattributes,\n\tbindings,\n\tfieldsList,\n\taddConnection,\n\tremoveConnection,\n} ) {\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn (\n\t\t<>\n\t\t\t{ attributes.map( ( attribute ) => {\n\t\t\t\tconst binding = bindings[ attribute ];\n\t\t\t\treturn (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tkey={ attribute }\n\t\t\t\t\t\thasValue={ () => !! binding }\n\t\t\t\t\t\tlabel={ attribute }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tremoveConnection( attribute );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\tplacement={\n\t\t\t\t\t\t\t\tisMobile ? 'bottom-start' : 'left-start'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tgutter={ isMobile ? 8 : 36 }\n\t\t\t\t\t\t\tclassName=\"block-editor-bindings__popover\"\n\t\t\t\t\t\t\ttrigger={\n\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t<BlockBindingsAttribute\n\t\t\t\t\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockBindingsPanelDropdown\n\t\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t\t\taddConnection={ addConnection }\n\t\t\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</DropdownMenu>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nexport const BlockBindingsPanel = ( { name, metadata } ) => {\n\tconst registry = useRegistry();\n\tconst blockContext = useContext( BlockContext );\n\tconst { bindings } = metadata || {};\n\n\tconst bindableAttributes = getBindableAttributes( name );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst filteredBindings = { ...bindings };\n\tObject.keys( filteredBindings ).forEach( ( key ) => {\n\t\tif (\n\t\t\t! canBindAttribute( name, key ) ||\n\t\t\tfilteredBindings[ key ].source === 'core/pattern-overrides'\n\t\t) {\n\t\t\tdelete filteredBindings[ key ];\n\t\t}\n\t} );\n\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tconst { _id } = useSelect( ( select ) => {\n\t\tconst { getSelectedBlockClientId } = select( blockEditorStore );\n\n\t\treturn {\n\t\t\t_id: getSelectedBlockClientId(),\n\t\t};\n\t}, [] );\n\n\tif ( ! bindableAttributes || bindableAttributes.length === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst removeAllConnections = () => {\n\t\tconst newMetadata = { ...metadata };\n\t\tdelete newMetadata.bindings;\n\t\tupdateBlockAttributes( _id, {\n\t\t\tmetadata:\n\t\t\t\tObject.keys( newMetadata ).length === 0\n\t\t\t\t\t? undefined\n\t\t\t\t\t: newMetadata,\n\t\t} );\n\t};\n\n\tconst addConnection = ( value, attribute ) => {\n\t\t// Assuming the block expects a flat structure for its metadata attribute\n\t\tconst newMetadata = {\n\t\t\t...metadata,\n\t\t\t// Adjust this according to the actual structure expected by your block\n\t\t\tbindings: {\n\t\t\t\t...metadata?.bindings,\n\t\t\t\t[ attribute ]: {\n\t\t\t\t\tsource: 'core/post-meta',\n\t\t\t\t\targs: { key: value },\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t\t// Update the block's attributes with the new metadata\n\t\tupdateBlockAttributes( _id, {\n\t\t\tmetadata: newMetadata,\n\t\t} );\n\t};\n\n\tconst removeConnection = ( key ) => {\n\t\tconst newMetadata = { ...metadata };\n\t\tif ( ! newMetadata.bindings ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdelete newMetadata.bindings[ key ];\n\t\tif ( Object.keys( newMetadata.bindings ).length === 0 ) {\n\t\t\tdelete newMetadata.bindings;\n\t\t}\n\t\tupdateBlockAttributes( _id, {\n\t\t\tmetadata:\n\t\t\t\tObject.keys( newMetadata ).length === 0\n\t\t\t\t\t? undefined\n\t\t\t\t\t: newMetadata,\n\t\t} );\n\t};\n\n\tconst fieldsList = {};\n\tconst { getBlockBindingsSources } = unlock( blocksPrivateApis );\n\tconst registeredSources = getBlockBindingsSources();\n\tObject.values( registeredSources ).forEach(\n\t\t( { getFieldsList, label, usesContext } ) => {\n\t\t\tif ( getFieldsList ) {\n\t\t\t\t// Populate context.\n\t\t\t\tconst context = {};\n\t\t\t\tif ( usesContext?.length ) {\n\t\t\t\t\tfor ( const key of usesContext ) {\n\t\t\t\t\t\tcontext[ key ] = blockContext[ key ];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst sourceList = getFieldsList( {\n\t\t\t\t\tregistry,\n\t\t\t\t\tcontext,\n\t\t\t\t} );\n\t\t\t\t// Only add source if the list is not empty.\n\t\t\t\tif ( sourceList ) {\n\t\t\t\t\tfieldsList[ label ] = { ...sourceList };\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\t// Remove empty sources.\n\tObject.entries( fieldsList ).forEach( ( [ key, value ] ) => {\n\t\tif ( ! Object.keys( value ).length ) {\n\t\t\tdelete fieldsList[ key ];\n\t\t}\n\t} );\n\n\t// Lock the UI when the experiment is not enabled or there are no fields to connect to.\n\tconst readOnly =\n\t\t! window.__experimentalBlockBindingsUI ||\n\t\t! Object.keys( fieldsList ).length;\n\n\tif ( readOnly && Object.keys( filteredBindings ).length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Attributes' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tremoveAllConnections();\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\tclassName=\"block-editor-bindings__panel\"\n\t\t\t>\n\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t{ readOnly ? (\n\t\t\t\t\t\t<ReadOnlyBlockBindingsPanelItems\n\t\t\t\t\t\t\tbindings={ filteredBindings }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<EditableBlockBindingsPanelItems\n\t\t\t\t\t\t\tattributes={ bindableAttributes }\n\t\t\t\t\t\t\tbindings={ filteredBindings }\n\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t\taddConnection={ addConnection }\n\t\t\t\t\t\t\tremoveConnection={ removeConnection }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ItemGroup>\n\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t{ __( 'Attributes connected to various sources.' ) }\n\t\t\t\t</Text>\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n};\n\nexport default {\n\tedit: BlockBindingsPanel,\n\tattributeKeys: [ 'metadata' ],\n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-161,6 +161,7 @@ function BlockHooksControlPure({
161
161
  }), groupedHookedBlocks[vendor].map(block => {
162
162
  const checked = (block.name in hookedBlockClientIds);
163
163
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
164
+ __nextHasNoMarginBottom: true,
164
165
  checked: checked,
165
166
  label: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
166
167
  justify: "flex-start",