@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
@@ -1 +1 @@
1
- {"version":3,"names":["useCallback","cloneBlock","createBlock","findTransform","getBlockTransforms","pasteHandler","store","blocksStore","useDispatch","useSelect","useRegistry","getFilesFromDataTransfer","blockEditorStore","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","sourceBlockIndex","includes","some","id","clientId","isAtSameLevel","draggedBlockCount","length","insertIndex","onFilesDrop","getSettings","updateBlockAttributes","canInsertBlockType","files","mediaUpload","transformation","transform","blockName","isMatch","onHTMLDrop","HTML","mode","useOnBlockDrop","options","nearestSide","getBlockOrder","getBlocksByClientId","isGroupable","getGroupingBlockName","insertBlocks","moveBlocksToPosition","replaceBlocks","removeBlocks","registry","updateSelection","initialPosition","clientIdsToReplace","Array","isArray","clientIds","blocksClientIds","areGroupableBlocks","undefined","targetBlock","push","unshift","groupInnerBlocks","name","attributes","innerBlocks","areAllImages","every","galleryBlock","wrappedBlocks","layout","flexWrap","sourceBlocks","targetBlockClientIds","targetBlockClientId","batch","_onDrop","_onFilesDrop","_onHTMLDrop","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":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,oBAAoB;AAChD,SACCC,UAAU,EACVC,WAAW,EACXC,aAAa,EACbC,kBAAkB,EAClBC,YAAY,EACZC,KAAK,IAAIC,WAAW,QACd,mBAAmB;AAC1B,SAASC,WAAW,EAAEC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACrE,SAASC,wBAAwB,QAAQ,gBAAgB;;AAEzD;AACA;AACA;AACA,SAASL,KAAK,IAAIM,gBAAgB,QAAQ,aAAa;;AAEvD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,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,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1BC,kBAAkB,EAClBC,gBAAgB,EAChBC,aAAa,EACbC,yBAAyB,EACzBC,UAAU,EACVC,qBAAqB,EACrBC,kBAAkB,EAClBC,SAAS,EACTC,QACD,CAAC;EACD,MAAMoE,YAAY,GAAGpD,WAAW,CAC/BxB,kBAAkB,EAClByB,WAAW,EACXC,qBAAqB,EACrBC,kBAAkB,EAClBtB,qBACD,CAAC;EACD,MAAMwE,WAAW,GAAG3C,UAAU,CAAE7B,qBAAsB,CAAC;EAEvD,OAASpB,KAAK,IAAM;IACnB,MAAM2C,KAAK,GAAG9C,wBAAwB,CAAEG,KAAK,CAACO,YAAa,CAAC;IAC5D,MAAMsF,IAAI,GAAG7F,KAAK,CAACO,YAAY,CAACK,OAAO,CAAE,WAAY,CAAC;;IAEtD;AACF;AACA;AACA;IACE,IAAKiF,IAAI,EAAG;MACXD,WAAW,CAAEC,IAAK,CAAC;IACpB,CAAC,MAAM,IAAKlD,KAAK,CAACN,MAAM,EAAG;MAC1BsD,YAAY,CAAEhD,KAAM,CAAC;IACtB,CAAC,MAAM;MACN+C,OAAO,CAAE1F,KAAM,CAAC;IACjB;EACD,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["useCallback","cloneBlock","createBlock","findTransform","getBlockTransforms","pasteHandler","store","blocksStore","useDispatch","useSelect","useRegistry","getFilesFromDataTransfer","blockEditorStore","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","sourceBlockIndex","includes","some","id","clientId","isAtSameLevel","draggedBlockCount","length","insertIndex","onFilesDrop","getSettings","updateBlockAttributes","canInsertBlockType","files","mediaUpload","transformation","transform","blockName","isMatch","onHTMLDrop","HTML","mode","useOnBlockDrop","options","nearestSide","getBlockOrder","getBlocksByClientId","getGroupingBlockName","insertBlocks","moveBlocksToPosition","replaceBlocks","removeBlocks","registry","updateSelection","initialPosition","clientIdsToReplace","Array","isArray","clientIds","undefined","targetBlock","push","unshift","groupInnerBlocks","name","attributes","innerBlocks","areAllImages","every","galleryBlock","wrappedBlocks","layout","flexWrap","sourceBlocks","targetBlockClientIds","targetBlockClientId","batch","_onDrop","_onFilesDrop","_onHTMLDrop","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":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,oBAAoB;AAChD,SACCC,UAAU,EACVC,WAAW,EACXC,aAAa,EACbC,kBAAkB,EAClBC,YAAY,EACZC,KAAK,IAAIC,WAAW,QACd,mBAAmB;AAC1B,SAASC,WAAW,EAAEC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACrE,SAASC,wBAAwB,QAAQ,gBAAgB;;AAEzD;AACA;AACA;AACA,SAASL,KAAK,IAAIM,gBAAgB,QAAQ,aAAa;;AAEvD;AACA;;AAEA;A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AAQ,EACRD,YAAY,EACZD,aAAa,EACb5C,gBAAgB,EAChBD,kBAAkB,CAEpB,CAAC;EAED,MAAMwE,OAAO,GAAGzE,WAAW,CAC1BC,kBAAkB,EAClBC,gBAAgB,EAChBC,aAAa,EACbC,yBAAyB,EACzBC,UAAU,EACVC,qBAAqB,EACrBC,kBAAkB,EAClBC,SAAS,EACTC,QACD,CAAC;EACD,MAAMiE,YAAY,GAAGjD,WAAW,CAC/BxB,kBAAkB,EAClByB,WAAW,EACXC,qBAAqB,EACrBC,kBAAkB,EAClBtB,qBACD,CAAC;EACD,MAAMqE,WAAW,GAAGxC,UAAU,CAAE7B,qBAAsB,CAAC;EAEvD,OAASpB,KAAK,IAAM;IACnB,MAAM2C,KAAK,GAAG9C,wBAAwB,CAAEG,KAAK,CAACO,YAAa,CAAC;IAC5D,MAAMmF,IAAI,GAAG1F,KAAK,CAACO,YAAY,CAACK,OAAO,CAAE,WAAY,CAAC;;IAEtD;AACF;AACA;AACA;IACE,IAAK8E,IAAI,EAAG;MACXD,WAAW,CAAEC,IAAK,CAAC;IACpB,CAAC,MAAM,IAAK/C,KAAK,CAACN,MAAM,EAAG;MAC1BmD,YAAY,CAAE7C,KAAM,CAAC;IACtB,CAAC,MAAM;MACN4C,OAAO,CAAEvF,KAAM,CAAC;IACjB;EACD,CAAC;AACF","ignoreList":[]}
@@ -36,7 +36,7 @@ export default function useResizeCanvas(deviceType) {
36
36
  }
37
37
  return deviceWidth < actualWidth ? deviceWidth : actualWidth;
38
38
  };
39
- const marginValue = () => window.innerHeight < 800 ? 36 : 72;
39
+ const marginValue = () => window.innerHeight < 800 ? 36 : 64;
40
40
  const contentInlineStyles = device => {
41
41
  const height = device === 'Mobile' ? '768px' : '1024px';
42
42
  const marginVertical = marginValue() + 'px';
@@ -53,8 +53,6 @@ export default function useResizeCanvas(deviceType) {
53
53
  marginLeft: marginHorizontal,
54
54
  marginRight: marginHorizontal,
55
55
  height,
56
- borderRadius: '2px 2px 2px 2px',
57
- border: '1px solid #ddd',
58
56
  overflowY: 'auto'
59
57
  };
60
58
  default:
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useState","useResizeCanvas","deviceType","actualWidth","updateActualWidth","window","innerWidth","resizeListener","addEventListener","removeEventListener","getCanvasWidth","device","deviceWidth","marginValue","innerHeight","contentInlineStyles","height","marginVertical","marginHorizontal","width","marginTop","marginBottom","marginLeft","marginRight","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":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;;AAExD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,eAAeA,CAAEC,UAAU,EAAG;EACrD,MAAM,CAAEC,WAAW,EAAEC,iBAAiB,CAAE,GAAGJ,QAAQ,CAAEK,MAAM,CAACC,UAAW,CAAC;EAExEP,SAAS,CAAE,MAAM;IAChB,IAAKG,UAAU,KAAK,SAAS,EAAG;MAC/B;IACD;IAEA,MAAMK,cAAc,GAAGA,CAAA,KAAMH,iBAAiB,CAAEC,MAAM,CAACC,UAAW,CAAC;IACnED,MAAM,CAACG,gBAAgB,CAAE,QAAQ,EAAED,cAAe,CAAC;IAEnD,OAAO,MAAM;MACZF,MAAM,CAACI,mBAAmB,CAAE,QAAQ,EAAEF,cAAe,CAAC;IACvD,CAAC;EACF,CAAC,EAAE,CAAEL,UAAU,CAAG,CAAC;EAEnB,MAAMQ,cAAc,GAAKC,MAAM,IAAM;IACpC,IAAIC,WAAW;IAEf,QAASD,MAAM;MACd,KAAK,QAAQ;QACZC,WAAW,GAAG,GAAG;QACjB;MACD,KAAK,QAAQ;QACZA,WAAW,GAAG,GAAG;QACjB;MACD;QACC,OAAO,IAAI;IACb;IAEA,OAAOA,WAAW,GAAGT,WAAW,GAAGS,WAAW,GAAGT,WAAW;EAC7D,CAAC;EAED,MAAMU,WAAW,GAAGA,CAAA,KAAQR,MAAM,CAACS,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,CAAEb,UAAW,CAAC;AACzC","ignoreList":[]}
1
+ {"version":3,"names":["useEffect","useState","useResizeCanvas","deviceType","actualWidth","updateActualWidth","window","innerWidth","resizeListener","addEventListener","removeEventListener","getCanvasWidth","device","deviceWidth","marginValue","innerHeight","contentInlineStyles","height","marginVertical","marginHorizontal","width","marginTop","marginBottom","marginLeft","marginRight","overflowY"],"sources":["@wordpress/block-editor/src/components/use-resize-canvas/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\n\n/**\n * Function to resize the editor window.\n *\n * @param {string} deviceType Used for determining the size of the container (e.g. Desktop, Tablet, Mobile)\n *\n * @return {Object} Inline styles to be added to resizable container.\n */\nexport default function useResizeCanvas( deviceType ) {\n\tconst [ actualWidth, updateActualWidth ] = useState( window.innerWidth );\n\n\tuseEffect( () => {\n\t\tif ( deviceType === 'Desktop' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst resizeListener = () => updateActualWidth( window.innerWidth );\n\t\twindow.addEventListener( 'resize', resizeListener );\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener( 'resize', resizeListener );\n\t\t};\n\t}, [ deviceType ] );\n\n\tconst getCanvasWidth = ( device ) => {\n\t\tlet deviceWidth;\n\n\t\tswitch ( device ) {\n\t\t\tcase 'Tablet':\n\t\t\t\tdeviceWidth = 780;\n\t\t\t\tbreak;\n\t\t\tcase 'Mobile':\n\t\t\t\tdeviceWidth = 360;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn null;\n\t\t}\n\n\t\treturn deviceWidth < actualWidth ? deviceWidth : actualWidth;\n\t};\n\n\tconst marginValue = () => ( window.innerHeight < 800 ? 36 : 64 );\n\n\tconst contentInlineStyles = ( device ) => {\n\t\tconst height = device === 'Mobile' ? '768px' : '1024px';\n\t\tconst marginVertical = marginValue() + 'px';\n\t\tconst marginHorizontal = 'auto';\n\n\t\tswitch ( device ) {\n\t\t\tcase 'Tablet':\n\t\t\tcase 'Mobile':\n\t\t\t\treturn {\n\t\t\t\t\twidth: getCanvasWidth( device ),\n\t\t\t\t\t// Keeping margin styles separate to avoid warnings\n\t\t\t\t\t// when those props get overridden in the iframe component\n\t\t\t\t\tmarginTop: marginVertical,\n\t\t\t\t\tmarginBottom: marginVertical,\n\t\t\t\t\tmarginLeft: marginHorizontal,\n\t\t\t\t\tmarginRight: marginHorizontal,\n\t\t\t\t\theight,\n\t\t\t\t\toverflowY: 'auto',\n\t\t\t\t};\n\t\t\tdefault:\n\t\t\t\treturn {\n\t\t\t\t\tmarginLeft: marginHorizontal,\n\t\t\t\t\tmarginRight: marginHorizontal,\n\t\t\t\t};\n\t\t}\n\t};\n\n\treturn contentInlineStyles( deviceType );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;;AAExD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,eAAeA,CAAEC,UAAU,EAAG;EACrD,MAAM,CAAEC,WAAW,EAAEC,iBAAiB,CAAE,GAAGJ,QAAQ,CAAEK,MAAM,CAACC,UAAW,CAAC;EAExEP,SAAS,CAAE,MAAM;IAChB,IAAKG,UAAU,KAAK,SAAS,EAAG;MAC/B;IACD;IAEA,MAAMK,cAAc,GAAGA,CAAA,KAAMH,iBAAiB,CAAEC,MAAM,CAACC,UAAW,CAAC;IACnED,MAAM,CAACG,gBAAgB,CAAE,QAAQ,EAAED,cAAe,CAAC;IAEnD,OAAO,MAAM;MACZF,MAAM,CAACI,mBAAmB,CAAE,QAAQ,EAAEF,cAAe,CAAC;IACvD,CAAC;EACF,CAAC,EAAE,CAAEL,UAAU,CAAG,CAAC;EAEnB,MAAMQ,cAAc,GAAKC,MAAM,IAAM;IACpC,IAAIC,WAAW;IAEf,QAASD,MAAM;MACd,KAAK,QAAQ;QACZC,WAAW,GAAG,GAAG;QACjB;MACD,KAAK,QAAQ;QACZA,WAAW,GAAG,GAAG;QACjB;MACD;QACC,OAAO,IAAI;IACb;IAEA,OAAOA,WAAW,GAAGT,WAAW,GAAGS,WAAW,GAAGT,WAAW;EAC7D,CAAC;EAED,MAAMU,WAAW,GAAGA,CAAA,KAAQR,MAAM,CAACS,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,SAAS,EAAE;QACZ,CAAC;MACF;QACC,OAAO;UACNF,UAAU,EAAEJ,gBAAgB;UAC5BK,WAAW,EAAEL;QACd,CAAC;IACH;EACD,CAAC;EAED,OAAOH,mBAAmB,CAAEb,UAAW,CAAC;AACzC","ignoreList":[]}
@@ -39,9 +39,10 @@ export function useSettings(...paths) {
39
39
  * It looks up the setting first in the block instance hierarchy.
40
40
  * If none is found, it'll look it up in the block editor settings.
41
41
  *
42
+ * @deprecated 6.5.0 Use useSettings instead.
43
+ *
42
44
  * @param {string} path The path to the setting.
43
45
  * @return {any} Returns the value defined for the setting.
44
- * @deprecated 6.5.0 Use useSettings instead.
45
46
  * @example
46
47
  * ```js
47
48
  * const isEnabled = useSetting( 'typography.dropCap' );
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","deprecated","useBlockEditContext","store","blockEditorStore","unlock","useSettings","paths","clientId","select","getBlockSettings","useSetting","path","since","alternative","note","value"],"sources":["@wordpress/block-editor/src/components/use-settings/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Hook that retrieves the given settings for the block instance in use.\n *\n * It looks up the settings first in the block instance hierarchy.\n * If none are found, it'll look them up in the block editor settings.\n *\n * @param {string[]} paths The paths to the settings.\n * @return {any[]} Returns the values defined for the settings.\n * @example\n * ```js\n * const [ fixed, sticky ] = useSettings( 'position.fixed', 'position.sticky' );\n * ```\n */\nexport function useSettings( ...paths ) {\n\tconst { clientId = null } = useBlockEditContext();\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tunlock( select( blockEditorStore ) ).getBlockSettings(\n\t\t\t\tclientId,\n\t\t\t\t...paths\n\t\t\t),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[ clientId, ...paths ]\n\t);\n}\n\n/**\n * Hook that retrieves the given setting for the block instance in use.\n *\n * It looks up the setting first in the block instance hierarchy.\n * If none is found, it'll look it up in the block editor settings.\n *\n * @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":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,SAASC,mBAAmB,QAAQ,eAAe;AACnD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,MAAM,QAAQ,mBAAmB;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAAE,GAAGC,KAAK,EAAG;EACvC,MAAM;IAAEC,QAAQ,GAAG;EAAK,CAAC,GAAGN,mBAAmB,CAAC,CAAC;EACjD,OAAOF,SAAS,CACbS,MAAM,IACPJ,MAAM,CAAEI,MAAM,CAAEL,gBAAiB,CAAE,CAAC,CAACM,gBAAgB,CACpDF,QAAQ,EACR,GAAGD,KACJ,CAAC;EACF;EACA,CAAEC,QAAQ,EAAE,GAAGD,KAAK,CACrB,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,UAAUA,CAAEC,IAAI,EAAG;EAClCX,UAAU,CAAE,2BAA2B,EAAE;IACxCY,KAAK,EAAE,KAAK;IACZC,WAAW,EAAE,4BAA4B;IACzCC,IAAI,EAAE;EACP,CAAE,CAAC;EAEH,MAAM,CAAEC,KAAK,CAAE,GAAGV,WAAW,CAAEM,IAAK,CAAC;EACrC,OAAOI,KAAK;AACb","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","deprecated","useBlockEditContext","store","blockEditorStore","unlock","useSettings","paths","clientId","select","getBlockSettings","useSetting","path","since","alternative","note","value"],"sources":["@wordpress/block-editor/src/components/use-settings/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Hook that retrieves the given settings for the block instance in use.\n *\n * It looks up the settings first in the block instance hierarchy.\n * If none are found, it'll look them up in the block editor settings.\n *\n * @param {string[]} paths The paths to the settings.\n * @return {any[]} Returns the values defined for the settings.\n * @example\n * ```js\n * const [ fixed, sticky ] = useSettings( 'position.fixed', 'position.sticky' );\n * ```\n */\nexport function useSettings( ...paths ) {\n\tconst { clientId = null } = useBlockEditContext();\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tunlock( select( blockEditorStore ) ).getBlockSettings(\n\t\t\t\tclientId,\n\t\t\t\t...paths\n\t\t\t),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[ clientId, ...paths ]\n\t);\n}\n\n/**\n * Hook that retrieves the given setting for the block instance in use.\n *\n * It looks up the setting first in the block instance hierarchy.\n * If none is found, it'll look it up in the block editor settings.\n *\n * @deprecated 6.5.0 Use useSettings instead.\n *\n * @param {string} path The path to the setting.\n * @return {any} Returns the value defined for the setting.\n * @example\n * ```js\n * const isEnabled = useSetting( 'typography.dropCap' );\n * ```\n */\nexport function useSetting( path ) {\n\tdeprecated( 'wp.blockEditor.useSetting', {\n\t\tsince: '6.5',\n\t\talternative: 'wp.blockEditor.useSettings',\n\t\tnote: 'The new useSettings function can retrieve multiple settings at once, with better performance.',\n\t} );\n\n\tconst [ value ] = useSettings( path );\n\treturn value;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,SAASC,mBAAmB,QAAQ,eAAe;AACnD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,MAAM,QAAQ,mBAAmB;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAAE,GAAGC,KAAK,EAAG;EACvC,MAAM;IAAEC,QAAQ,GAAG;EAAK,CAAC,GAAGN,mBAAmB,CAAC,CAAC;EACjD,OAAOF,SAAS,CACbS,MAAM,IACPJ,MAAM,CAAEI,MAAM,CAAEL,gBAAiB,CAAE,CAAC,CAACM,gBAAgB,CACpDF,QAAQ,EACR,GAAGD,KACJ,CAAC;EACF;EACA,CAAEC,QAAQ,EAAE,GAAGD,KAAK,CACrB,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,UAAUA,CAAEC,IAAI,EAAG;EAClCX,UAAU,CAAE,2BAA2B,EAAE;IACxCY,KAAK,EAAE,KAAK;IACZC,WAAW,EAAE,4BAA4B;IACzCC,IAAI,EAAE;EACP,CAAE,CAAC;EAEH,MAAM,CAAEC,KAAK,CAAE,GAAGV,WAAW,CAAEM,IAAK,CAAC;EACrC,OAAOI,KAAK;AACb","ignoreList":[]}
@@ -2,75 +2,288 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { store as blocksStore } from '@wordpress/blocks';
6
- import { BaseControl, PanelBody, __experimentalHStack as HStack, __experimentalItemGroup as ItemGroup, __experimentalItem as Item } from '@wordpress/components';
7
- import { useSelect } from '@wordpress/data';
5
+ import { privateApis as blocksPrivateApis } from '@wordpress/blocks';
6
+ import { __experimentalItemGroup as ItemGroup, __experimentalItem as Item, __experimentalText as Text, __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem, __experimentalTruncate as Truncate, __experimentalVStack as VStack, privateApis as componentsPrivateApis } from '@wordpress/components';
7
+ import { useSelect, useDispatch, useRegistry } from '@wordpress/data';
8
+ import { useContext, Fragment } from '@wordpress/element';
9
+ import { useViewportMatch } from '@wordpress/compose';
8
10
 
9
11
  /**
10
12
  * Internal dependencies
11
13
  */
12
- import { canBindAttribute } from '../hooks/use-bindings-attributes';
14
+ import { canBindAttribute, getBindableAttributes } from '../hooks/use-bindings-attributes';
15
+ import { store as blockEditorStore } from '../store';
13
16
  import { unlock } from '../lock-unlock';
14
17
  import InspectorControls from '../components/inspector-controls';
18
+ import BlockContext from '../components/block-context';
15
19
  import { jsx as _jsx } from "react/jsx-runtime";
16
20
  import { jsxs as _jsxs } from "react/jsx-runtime";
21
+ import { Fragment as _Fragment } from "react/jsx-runtime";
22
+ const {
23
+ DropdownMenuV2: DropdownMenu,
24
+ DropdownMenuGroupV2: DropdownMenuGroup,
25
+ DropdownMenuRadioItemV2: DropdownMenuRadioItem,
26
+ DropdownMenuItemLabelV2: DropdownMenuItemLabel,
27
+ DropdownMenuItemHelpTextV2: DropdownMenuItemHelpText,
28
+ DropdownMenuSeparatorV2: DropdownMenuSeparator
29
+ } = unlock(componentsPrivateApis);
30
+ const useToolsPanelDropdownMenuProps = () => {
31
+ const isMobile = useViewportMatch('medium', '<');
32
+ return !isMobile ? {
33
+ popoverProps: {
34
+ placement: 'left-start',
35
+ // For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)
36
+ offset: 259
37
+ }
38
+ } : {};
39
+ };
40
+ function BlockBindingsPanelDropdown({
41
+ fieldsList,
42
+ addConnection,
43
+ attribute,
44
+ binding
45
+ }) {
46
+ const currentKey = binding?.args?.key;
47
+ return /*#__PURE__*/_jsx(_Fragment, {
48
+ children: Object.entries(fieldsList).map(([label, fields], i) => /*#__PURE__*/_jsxs(Fragment, {
49
+ children: [/*#__PURE__*/_jsxs(DropdownMenuGroup, {
50
+ children: [Object.keys(fieldsList).length > 1 && /*#__PURE__*/_jsx(Text, {
51
+ className: "block-editor-bindings__source-label",
52
+ upperCase: true,
53
+ variant: "muted",
54
+ "aria-hidden": true,
55
+ children: label
56
+ }), Object.entries(fields).map(([key, value]) => /*#__PURE__*/_jsxs(DropdownMenuRadioItem, {
57
+ onChange: () => addConnection(key, attribute),
58
+ name: attribute + '-binding',
59
+ value: key,
60
+ checked: key === currentKey,
61
+ children: [/*#__PURE__*/_jsx(DropdownMenuItemLabel, {
62
+ children: key
63
+ }), /*#__PURE__*/_jsx(DropdownMenuItemHelpText, {
64
+ children: value
65
+ })]
66
+ }, key))]
67
+ }), i !== Object.keys(fieldsList).length - 1 && /*#__PURE__*/_jsx(DropdownMenuSeparator, {})]
68
+ }, label))
69
+ });
70
+ }
71
+ function BlockBindingsAttribute({
72
+ attribute,
73
+ binding
74
+ }) {
75
+ const {
76
+ source: sourceName,
77
+ args
78
+ } = binding || {};
79
+ const sourceProps = unlock(blocksPrivateApis).getBlockBindingsSource(sourceName);
80
+ return /*#__PURE__*/_jsxs(VStack, {
81
+ children: [/*#__PURE__*/_jsx(Truncate, {
82
+ children: attribute
83
+ }), !!binding && /*#__PURE__*/_jsx(Text, {
84
+ variant: "muted",
85
+ className: "block-editor-bindings__item-explanation",
86
+ children: /*#__PURE__*/_jsx(Truncate, {
87
+ children: args?.key || sourceProps?.label || sourceName
88
+ })
89
+ })]
90
+ });
91
+ }
92
+ function ReadOnlyBlockBindingsPanelItems({
93
+ bindings
94
+ }) {
95
+ return /*#__PURE__*/_jsx(_Fragment, {
96
+ children: Object.entries(bindings).map(([attribute, binding]) => /*#__PURE__*/_jsx(Item, {
97
+ children: /*#__PURE__*/_jsx(BlockBindingsAttribute, {
98
+ attribute: attribute,
99
+ binding: binding
100
+ })
101
+ }, attribute))
102
+ });
103
+ }
104
+ function EditableBlockBindingsPanelItems({
105
+ attributes,
106
+ bindings,
107
+ fieldsList,
108
+ addConnection,
109
+ removeConnection
110
+ }) {
111
+ const isMobile = useViewportMatch('medium', '<');
112
+ return /*#__PURE__*/_jsx(_Fragment, {
113
+ children: attributes.map(attribute => {
114
+ const binding = bindings[attribute];
115
+ return /*#__PURE__*/_jsx(ToolsPanelItem, {
116
+ hasValue: () => !!binding,
117
+ label: attribute,
118
+ onDeselect: () => {
119
+ removeConnection(attribute);
120
+ },
121
+ children: /*#__PURE__*/_jsx(DropdownMenu, {
122
+ placement: isMobile ? 'bottom-start' : 'left-start',
123
+ gutter: isMobile ? 8 : 36,
124
+ className: "block-editor-bindings__popover",
125
+ trigger: /*#__PURE__*/_jsx(Item, {
126
+ children: /*#__PURE__*/_jsx(BlockBindingsAttribute, {
127
+ attribute: attribute,
128
+ binding: binding
129
+ })
130
+ }),
131
+ children: /*#__PURE__*/_jsx(BlockBindingsPanelDropdown, {
132
+ fieldsList: fieldsList,
133
+ addConnection: addConnection,
134
+ attribute: attribute,
135
+ binding: binding
136
+ })
137
+ })
138
+ }, attribute);
139
+ })
140
+ });
141
+ }
17
142
  export const BlockBindingsPanel = ({
18
143
  name,
19
144
  metadata
20
145
  }) => {
146
+ const registry = useRegistry();
147
+ const blockContext = useContext(BlockContext);
21
148
  const {
22
149
  bindings
23
150
  } = metadata || {};
151
+ const bindableAttributes = getBindableAttributes(name);
152
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
153
+ const filteredBindings = {
154
+ ...bindings
155
+ };
156
+ Object.keys(filteredBindings).forEach(key => {
157
+ if (!canBindAttribute(name, key) || filteredBindings[key].source === 'core/pattern-overrides') {
158
+ delete filteredBindings[key];
159
+ }
160
+ });
24
161
  const {
25
- sources
162
+ updateBlockAttributes
163
+ } = useDispatch(blockEditorStore);
164
+ const {
165
+ _id
26
166
  } = useSelect(select => {
27
- const _sources = unlock(select(blocksStore)).getAllBlockBindingsSources();
167
+ const {
168
+ getSelectedBlockClientId
169
+ } = select(blockEditorStore);
28
170
  return {
29
- sources: _sources
171
+ _id: getSelectedBlockClientId()
30
172
  };
31
173
  }, []);
32
- if (!bindings) {
174
+ if (!bindableAttributes || bindableAttributes.length === 0) {
33
175
  return null;
34
176
  }
35
-
36
- // Don't show not allowed attributes.
37
- // Don't show the bindings connected to pattern overrides in the inspectors panel.
38
- // TODO: Explore if this should be abstracted to let other sources decide.
39
- const filteredBindings = {
40
- ...bindings
177
+ const removeAllConnections = () => {
178
+ const newMetadata = {
179
+ ...metadata
180
+ };
181
+ delete newMetadata.bindings;
182
+ updateBlockAttributes(_id, {
183
+ metadata: Object.keys(newMetadata).length === 0 ? undefined : newMetadata
184
+ });
41
185
  };
42
- Object.keys(filteredBindings).forEach(key => {
43
- if (!canBindAttribute(name, key) || filteredBindings[key].source === 'core/pattern-overrides') {
44
- delete filteredBindings[key];
186
+ const addConnection = (value, attribute) => {
187
+ // Assuming the block expects a flat structure for its metadata attribute
188
+ const newMetadata = {
189
+ ...metadata,
190
+ // Adjust this according to the actual structure expected by your block
191
+ bindings: {
192
+ ...metadata?.bindings,
193
+ [attribute]: {
194
+ source: 'core/post-meta',
195
+ args: {
196
+ key: value
197
+ }
198
+ }
199
+ }
200
+ };
201
+ // Update the block's attributes with the new metadata
202
+ updateBlockAttributes(_id, {
203
+ metadata: newMetadata
204
+ });
205
+ };
206
+ const removeConnection = key => {
207
+ const newMetadata = {
208
+ ...metadata
209
+ };
210
+ if (!newMetadata.bindings) {
211
+ return;
212
+ }
213
+ delete newMetadata.bindings[key];
214
+ if (Object.keys(newMetadata.bindings).length === 0) {
215
+ delete newMetadata.bindings;
216
+ }
217
+ updateBlockAttributes(_id, {
218
+ metadata: Object.keys(newMetadata).length === 0 ? undefined : newMetadata
219
+ });
220
+ };
221
+ const fieldsList = {};
222
+ const {
223
+ getBlockBindingsSources
224
+ } = unlock(blocksPrivateApis);
225
+ const registeredSources = getBlockBindingsSources();
226
+ Object.values(registeredSources).forEach(({
227
+ getFieldsList,
228
+ label,
229
+ usesContext
230
+ }) => {
231
+ if (getFieldsList) {
232
+ // Populate context.
233
+ const context = {};
234
+ if (usesContext?.length) {
235
+ for (const key of usesContext) {
236
+ context[key] = blockContext[key];
237
+ }
238
+ }
239
+ const sourceList = getFieldsList({
240
+ registry,
241
+ context
242
+ });
243
+ // Only add source if the list is not empty.
244
+ if (sourceList) {
245
+ fieldsList[label] = {
246
+ ...sourceList
247
+ };
248
+ }
45
249
  }
46
250
  });
47
- if (Object.keys(filteredBindings).length === 0) {
251
+ // Remove empty sources.
252
+ Object.entries(fieldsList).forEach(([key, value]) => {
253
+ if (!Object.keys(value).length) {
254
+ delete fieldsList[key];
255
+ }
256
+ });
257
+
258
+ // Lock the UI when the experiment is not enabled or there are no fields to connect to.
259
+ const readOnly = !window.__experimentalBlockBindingsUI || !Object.keys(fieldsList).length;
260
+ if (readOnly && Object.keys(filteredBindings).length === 0) {
48
261
  return null;
49
262
  }
50
263
  return /*#__PURE__*/_jsx(InspectorControls, {
51
- children: /*#__PURE__*/_jsx(PanelBody, {
52
- title: __('Attributes'),
53
- className: "components-panel__block-bindings-panel",
54
- children: /*#__PURE__*/_jsx(BaseControl, {
55
- help: __('Attributes connected to various sources.'),
56
- children: /*#__PURE__*/_jsx(ItemGroup, {
57
- isBordered: true,
58
- isSeparated: true,
59
- size: "large",
60
- children: Object.keys(filteredBindings).map(key => {
61
- return /*#__PURE__*/_jsx(Item, {
62
- children: /*#__PURE__*/_jsxs(HStack, {
63
- children: [/*#__PURE__*/_jsx("span", {
64
- children: key
65
- }), /*#__PURE__*/_jsx("span", {
66
- className: "components-item__block-bindings-source",
67
- children: sources[filteredBindings[key].source] ? sources[filteredBindings[key].source].label : filteredBindings[key].source
68
- })]
69
- })
70
- }, key);
71
- })
264
+ children: /*#__PURE__*/_jsxs(ToolsPanel, {
265
+ label: __('Attributes'),
266
+ resetAll: () => {
267
+ removeAllConnections();
268
+ },
269
+ dropdownMenuProps: dropdownMenuProps,
270
+ className: "block-editor-bindings__panel",
271
+ children: [/*#__PURE__*/_jsx(ItemGroup, {
272
+ isBordered: true,
273
+ isSeparated: true,
274
+ children: readOnly ? /*#__PURE__*/_jsx(ReadOnlyBlockBindingsPanelItems, {
275
+ bindings: filteredBindings
276
+ }) : /*#__PURE__*/_jsx(EditableBlockBindingsPanelItems, {
277
+ attributes: bindableAttributes,
278
+ bindings: filteredBindings,
279
+ fieldsList: fieldsList,
280
+ addConnection: addConnection,
281
+ removeConnection: removeConnection
72
282
  })
73
- })
283
+ }), /*#__PURE__*/_jsx(Text, {
284
+ variant: "muted",
285
+ children: __('Attributes connected to various sources.')
286
+ })]
74
287
  })
75
288
  });
76
289
  };
@@ -1 +1 @@
1
- {"version":3,"names":["__","store","blocksStore","BaseControl","PanelBody","__experimentalHStack","HStack","__experimentalItemGroup","ItemGroup","__experimentalItem","Item","useSelect","canBindAttribute","unlock","InspectorControls","jsx","_jsx","jsxs","_jsxs","BlockBindingsPanel","name","metadata","bindings","sources","select","_sources","getAllBlockBindingsSources","filteredBindings","Object","keys","forEach","key","source","length","children","title","className","help","isBordered","isSeparated","size","map","label","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":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SACCC,WAAW,EACXC,SAAS,EACTC,oBAAoB,IAAIC,MAAM,EAC9BC,uBAAuB,IAAIC,SAAS,EACpCC,kBAAkB,IAAIC,IAAI,QACpB,uBAAuB;AAC9B,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,gBAAgB,QAAQ,kCAAkC;AACnE,SAASC,MAAM,QAAQ,gBAAgB;AACvC,OAAOC,iBAAiB,MAAM,kCAAkC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEjE,OAAO,MAAMC,k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,CAACC,IAAI,CAAEF,gBAAiB,CAAC,CAACc,GAAG,CAAIV,GAAG,IAAM;YACjD,oBACCf,IAAA,CAACN,IAAI;cAAAwB,QAAA,eACJhB,KAAA,CAACZ,MAAM;gBAAA4B,QAAA,gBACNlB,IAAA;kBAAAkB,QAAA,EAAQH;gBAAG,CAAQ,CAAC,eACpBf,IAAA;kBAAMoB,SAAS,EAAC,wCAAwC;kBAAAF,QAAA,EACrDX,OAAO,CACRI,gBAAgB,CAAEI,GAAG,CAAE,CAACC,MAAM,CAC9B,GACET,OAAO,CACPI,gBAAgB,CAAEI,GAAG,CAAE,CACrBC,MAAM,CACP,CAACU,KAAK,GACPf,gBAAgB,CAAEI,GAAG,CAAE,CACtBC;gBAAM,CACL,CAAC;cAAA,CACA;YAAC,GAdED,GAeN,CAAC;UAET,CAAE;QAAC,CACO;MAAC,CACA;IAAC,CACJ;EAAC,CACM,CAAC;AAEtB,CAAC;AAED,eAAe;EACdY,IAAI,EAAExB,kBAAkB;EACxByB,aAAa,EAAE,CAAE,UAAU,CAAE;EAC7BC,UAAUA,CAAA,EAAG;IACZ,OAAO,IAAI;EACZ;AACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["__","privateApis","blocksPrivateApis","__experimentalItemGroup","ItemGroup","__experimentalItem","Item","__experimentalText","Text","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalTruncate","Truncate","__experimentalVStack","VStack","componentsPrivateApis","useSelect","useDispatch","useRegistry","useContext","Fragment","useViewportMatch","canBindAttribute","getBindableAttributes","store","blockEditorStore","unlock","InspectorControls","BlockContext","jsx","_jsx","jsxs","_jsxs","_Fragment","DropdownMenuV2","DropdownMenu","DropdownMenuGroupV2","DropdownMenuGroup","DropdownMenuRadioItemV2","DropdownMenuRadioItem","DropdownMenuItemLabelV2","DropdownMenuItemLabel","DropdownMenuItemHelpTextV2","DropdownMenuItemHelpText","DropdownMenuSeparatorV2","DropdownMenuSeparator","useToolsPanelDropdownMenuProps","isMobile","popoverProps","placement","offset","BlockBindingsPanelDropdown","fieldsList","addConnection","attribute","binding","currentKey","args","key","children","Object","entries","map","label","fields","i","keys","length","className","upperCase","variant","value","onChange","name","checked","BlockBindingsAttribute","source","sourceName","sourceProps","getBlockBindingsSource","ReadOnlyBlockBindingsPanelItems","bindings","EditableBlockBindingsPanelItems","attributes","removeConnection","hasValue","onDeselect","gutter","trigger","BlockBindingsPanel","metadata","registry","blockContext","bindableAttributes","dropdownMenuProps","filteredBindings","forEach","updateBlockAttributes","_id","select","getSelectedBlockClientId","removeAllConnections","newMetadata","undefined","getBlockBindingsSources","registeredSources","values","getFieldsList","usesContext","context","sourceList","readOnly","window","__experimentalBlockBindingsUI","resetAll","isBordered","isSeparated","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\thasSupport() {\n\t\treturn true;\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SACCC,uBAAuB,IAAIC,SAAS,EACpCC,kBAAkB,IAAIC,IAAI,EAC1BC,kBAAkB,IAAIC,IAAI,EAC1BC,wBAAwB,IAAIC,UAAU,EACtCC,4BAA4B,IAAIC,cAAc,EAC9CC,sBAAsB,IAAIC,QAAQ,EAClCC,oBAAoB,IAAIC,MAAM,EAC9Bf,WAAW,IAAIgB,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,SAAS,EAAEC,WAAW,EAAEC,WAAW,QAAQ,iBAAiB;AACrE,SAASC,UAAU,EAAEC,QAAQ,QAAQ,oBAAoB;AACzD,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;AACA,SACCC,gBAAgB,EAChBC,qBAAqB,QACf,kCAAkC;AACzC,SAASC,KAAK,IAAI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ockHooksControlPure({
155
155
  }), groupedHookedBlocks[vendor].map(block => {
156
156
  const checked = (block.name in hookedBlockClientIds);
157
157
  return /*#__PURE__*/_jsx(ToggleControl, {
158
+ __nextHasNoMarginBottom: true,
158
159
  checked: checked,
159
160
  label: /*#__PURE__*/_jsxs(HStack, {
160
161
  justify: "flex-start",